fastapi-socketio
fastapi-socketio copied to clipboard
How to set SocketManager server options?
trafficstars
Where to set pingTimeout for server https://socket.io/docs/v4/server-options/#pingtimeout ?
you need to pass them as kwargs to SocketManager's initializer. Kwargs are then forwarded to socketio.AsyncServer's initializer. Here's the implementation:
# SocketManager's initializer:
def __init__(
self,
...
**kwargs
) -> None:
self._sio = socketio.AsyncServer(async_mode=async_mode, cors_allowed_origins=cors_allowed_origins, **kwargs)
...
And in AsyncServer you have all these params used both by Asyncserver and by EngineIO, among others ping_timeout (reference for parameters: https://python-socketio.readthedocs.io/en/latest/api.html#asyncserver-class)