Describe the bug
Related to flask-socketio #1174, I needed to be able to disconnect clients by their sid from external processes (such as Celery). Thanks to the work done in flask-socketio #1174 this is possible, but it looks like it may have partially broken somewhere along the way. Calling disconnect on a write_only manager doesn't throw an exception, but nothing happens. I've inspected the messages being sent through redis and it simply isn't sending one. That said, calling can_disconnect or _publish directly both work.
To Reproduce
I have only tested with an AsyncServer and redis, so I'm not sure at the moment if it affects all managers. Note though that the manager I'm calling disconnect on is a sync redis manager.
- Set up a server:
import socketio
mgr = socketio.AsyncRedisManager(...)
sio = socketio.AsyncServer(client_manager=mgr, ...)
- Set up a write-only manager:
external_sio = socketio.RedisManager(..., write_only=True)
- Connect to the SocketIO server and grab the
sid (not strictly necessary)
- Run
external_sio.disconnect('sid_here', namespace='/some_namespace')
- Observe that the client isn't disconnected. Furthermore, you'll notice that the
pubsub message: disconnect log doesn't show up (see this line). I subclassed the manager and confirmed that nothing was being received at all, so it isn't just getting stopped somewhere in the middle of _thread.
Expected behavior
The disconnect event should be sent through redis.
Logs
No logs, but that's part of the problem 😄
Additional context
Thank you so much for this fantastic library, it's a life saver. To anyone else experiencing this in the meantime, you can use external_sio.can_disconnect instead.
Describe the bug
Related to flask-socketio #1174, I needed to be able to disconnect clients by their sid from external processes (such as Celery). Thanks to the work done in flask-socketio #1174 this is possible, but it looks like it may have partially broken somewhere along the way. Calling
disconnecton a write_only manager doesn't throw an exception, but nothing happens. I've inspected the messages being sent through redis and it simply isn't sending one. That said, callingcan_disconnector_publishdirectly both work.To Reproduce
I have only tested with an
AsyncServerand redis, so I'm not sure at the moment if it affects all managers. Note though that the manager I'm callingdisconnecton is a sync redis manager.sid(not strictly necessary)external_sio.disconnect('sid_here', namespace='/some_namespace')pubsub message: disconnectlog doesn't show up (see this line). I subclassed the manager and confirmed that nothing was being received at all, so it isn't just getting stopped somewhere in the middle of_thread.Expected behavior
The disconnect event should be sent through redis.
Logs
No logs, but that's part of the problem 😄
Additional context
Thank you so much for this fantastic library, it's a life saver. To anyone else experiencing this in the meantime, you can use
external_sio.can_disconnectinstead.