-
Notifications
You must be signed in to change notification settings - Fork 10.1k
List clients in a room? #1506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Duplicate #1544 |
Can this be re-opened for version 4? |
@ChristopherHButler you can use the // return all Socket instances
const sockets = await io.fetchSockets();
// return all Socket instances in the "room1" room of the main namespace
const sockets = await io.in("room1").fetchSockets();
// return all Socket instances in the "room1" room of the "admin" namespace
const sockets = await io.of("/admin").in("room1").fetchSockets();
// this also works with a single socket ID
const sockets = await io.in(theSocketId).fetchSockets(); Documentation: https://socket.io/docs/v4/server-instance/#Utility-methods |
Perfect, thank you @darrachequesne !! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In 0.9.x we had a nice method
.clients
. Is there any equivalent in 1.0?The text was updated successfully, but these errors were encountered: