Skip to content

Flask-SocketIO - WebSocket is closed before the connection is established. [Heroku] #1708

Answered by miguelgrinberg
KarteekAti asked this question in Q&A
Discussion options

You must be logged in to vote

Do you see the discrepancy? You are running Gunicorn with the gevent-websocket worker, but Flask-SocketIO thinks it is configured to use eventlet:

RuntimeError: You need to use the eventlet server. See the Deployment section of the documentation for more information.

Which one do you want to use? If you want gevent, then add async_mode='gevent' to your SocketIO() object, to override the default. Or as an alternative, make sure eventlet is not installed in your virtualenv, and then Flask-SocketIO is going to go with the next option, which is gevent.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KarteekAti
Comment options

Answer selected by KarteekAti
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants