Search code examples
pythonazurewebsocketreal-timeazure-web-app-service

Python websocket support on Azure web appservice?


Does Azure appservice has native websockets for Python like they do for node.js/.net?

I'm assuming as of right now, the answer is no, and you'd need to use a VM to achieve this?

(fyi. there's a similar question here but it's been deleted.)


Solution

  • The answer if yes, Python websocket support on Azure Web Apps. The necessary steps or guideline as below.

    1. First of all, you need to enable the WEB SOCKETS option of Application settings to ON on Azure portal, as the blog said as below, it's matter with any languages.

    enter image description here

    1. Azure IIS supports Python webapp using WSGI, you can refer to the tutorial to know it and follow the tutorial content to build & configure your Python webapp with WSGI.

    2. There is a similar Combining websockets and WSGI in a python app SO thread which had been answered about the feasibility for websocket with WSGI in Python. And as references, there are some packages supported this combination, such as Eventlet, dwebsocket for Django, etc that you can search the words websocket & wsgi to know more.

    Hope it helps.