Set async mode in web api #290

This commit is contained in:
Sven Heidemann 2023-04-02 14:41:05 +02:00
parent e05e67785b
commit 583218b215

View File

@ -53,7 +53,9 @@ class Api(Flask):
self.register_error_handler(exc_class, self.handle_exception) self.register_error_handler(exc_class, self.handle_exception)
# websockets # websockets
self._socketio = SocketIO(self, cors_allowed_origins="*", path="/api/socket.io") # Added async_mode see link below
# https://stackoverflow.com/questions/39370848/flask-socket-io-sometimes-client-calls-freeze-the-server
self._socketio = SocketIO(self, cors_allowed_origins="*", path="/api/socket.io", async_mode="eventlet")
self._socketio.on_event("connect", self.on_connect) self._socketio.on_event("connect", self.on_connect)
self._socketio.on_event("disconnect", self.on_disconnect) self._socketio.on_event("disconnect", self.on_disconnect)