Set async mode in web api #290

This commit is contained in:
Sven Heidemann 2023-04-02 18:30:46 +02:00
parent 583218b215
commit c1e8274f46

View File

@ -55,7 +55,8 @@ class Api(Flask):
# websockets # websockets
# Added async_mode see link below # Added async_mode see link below
# https://stackoverflow.com/questions/39370848/flask-socket-io-sometimes-client-calls-freeze-the-server # 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") # https://github.com/miguelgrinberg/Flask-SocketIO/discussions/1849
self._socketio = SocketIO(self, cors_allowed_origins="*", path="/api/socket.io", async_mode="threading")
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)