Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebSocket transport not available. Install eventlet or gevent and gevent-websocket for improved performance

I am using socket io and flask application.Everthing works except I always get this message. This is my initialization:

app = Flask(__name__)
app.config['SECRET_KEY'] = APP_SECRET_KEY
jwt = JWTManager(app)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
# app.config['transports'] = 'websocket'
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading')

socketio.run(app, debug=True)

What may cause this warning and what does it mean?

The console looks like this: enter image description here

  • tried already to install gevent and eventlet and it didn't remove the message
like image 845
MD10 Avatar asked Apr 02 '20 12:04

MD10


2 Answers

If it's the problem occurred when executing a python file Just try pip install eventlet its worked for me you can also try pip install gevent some times this can also do the trick!

like image 167
SREERAG R NANDAN Avatar answered Oct 22 '22 01:10

SREERAG R NANDAN


Normally you do not include the async_mode option when you instantiate your server. By having async_mode='threading' you are forcing the server to ignore eventlet and/or gevent and go with the more basic server, which does not support WebSocket.

So remove async_mode, then install eventlet (or gevent and gevent-websocket). Now your server will have access to WebSocket and will not show the warning.

like image 8
Miguel Avatar answered Oct 22 '22 01:10

Miguel