Does Azure Function App supports socket io with python?

Avinash Mishra 21 Reputation points
2022-07-26T05:52:00.757+00:00

I have created a python socket io server in python and started with flask app. It's working fine on local machine whenever a client hits the flask server it makes the initial handshake with socket io server. When I deployed the same on Azure Function app the deployment was successful and other flask endpoint is also working fine. But when I run any client initially connection established but after few seconds it disconnects and try reconnecting.

Please let me know if there is any solution. Or weather it is possible to use socket io with Azure Function App or I have to move to Ec2 machine.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

Accepted answer
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-08-08T08:13:20.423+00:00

    Hi @Avinash Mishra ,

    Thanks for reaching out to Q&A forum.

    Azure functions supports socket io. You can take a look at the following sample code for the implementation of socket io in Function app

    https://github.com/edisga/flask-websockets-gunicorn-gevent

    You can also try the below versions of js and python libraries

    js versions in html

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.3/socket.io.min.js"></script>

    Python libraries

    Flask==2.0.2
    Flask-SocketIO==5.1.1
    eventlet==0.30.2

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.