flask-sock icon indicating copy to clipboard operation
flask-sock copied to clipboard

How to extend this to work with uWSGI?

Open etale-cohomology opened this issue 2 years ago • 2 comments

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?)

etale-cohomology avatar Jul 01 '22 00:07 etale-cohomology

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.

miguelgrinberg avatar Jul 01 '22 09:07 miguelgrinberg

Thank you for the reply. And the tutorials.

etale-cohomology avatar Jul 05 '22 06:07 etale-cohomology