miguelgrinberg / flask-sock

Modern WebSocket support for Flask.
MIT License
274 stars 24 forks source link

How to extend this to work with uWSGI? #29

Open etale-cohomology opened 2 years ago

etale-cohomology commented 2 years ago

Hi, my understanding is that this only works with the Flask dev server, and with gunicorn.

How can one extend this to work with uwsgi too?

I got flask-socketio working with uwsgi (and gevent) doing something like:

uwsgi --module app:app  --touch-reload app.py  --master  --http :8000  --http-websockets  --gevent 1024

but (unsurprisingly) the same thing doesn't work with flask-sock, probably because support for uwsgi needs to be specifically implemented. (But how?)

miguelgrinberg commented 2 years ago

You are correct, I have not implemented uWSGI support in this package. Flask-Sock uses its own WebSocket implementation (provided by the wsproto package) instead of relying on the web server's own WebSocket support. With uWSGI I'm not sure it is possible to use a custom WebSocket implementation. Gunicorn, Werkzeug, Eventlet and Gevent make it easy, so that is why these are the solutions I have implemented.

etale-cohomology commented 2 years ago

Thank you for the reply. And the tutorials.