From the deployment section in the documentation, Gunicorn can only work with 1 worker process with Flask-SocketIO. I was wondering what is the preferred way to deploy a flask-socket-io server? Currently I have a regular Flask app that uses a multi-worker gunicorn server that is proxy-passed to from nginx. While I don't have any load balancing, I expect concurrency to be taken care of by the multiple gunicorn workers, and not having that concerns me a little bit for the websockets server.
Maybe I misunderstand the way eventlets/greenlets function but I see uwsgi as the only other alternative that I have not explored. Is it worth gettinginto the learning curve of uwsgi for this purpose?
Both Gunicorn and uWSGI have a very limited load balancer that does not support the required sticky sessions.
If you want to use multiple workers with either of these frameworks, you need to start several single-worker servers on their own ports, and then use nginx in front as load balancer.
In addition to nginx, you need to add a message queue (RabbitMQ, Redis, etc) that all these processes can use to coordinate efforts.
See the documentation on deploying multiple servers here: https://flask-socketio.readthedocs.io/en/latest/deployment.html#using-multiple-workers