I want to statically remove all users from a room, effectively deleting that room. The idea is that another room with the same name may be created again in the future, but I want it created empty (without the listeners from the previous room).
I'm not interested in managing the room status myself but rather curious as if I can leverage socket.io internals to do this. Is this possible? (see also this question)
For an up-to-date answer to this question, everyone who wants to remove a room can make use of
Namespace.clients(cb)
. Thecb
callback will receive an error object as the first argument (null
if no error) and a list of socket IDs as the second argument.It should work fine with
socket.io
v2.1.0
, not sure which version is the earliest compatible one.@See https://github.com/socketio/socket.io/issues/3042
@See https://socket.io/docs/server-api/#namespace-clients-callback
Is that what you want ?