Skip to content

Does fetchSockets return all sockets from all nodes? #4513

Discussion options

You must be logged in to vote

@nicholaswmin yes it does! You can also use the local flag if you need it:

// all sockets across all nodes
const allSockets = await io.in("room1").fetchSockets();

// all sockets on the node
const sockets = await io.local.in("room1").fetchSockets();

Reference: https://socket.io/docs/v4/server-api/#serverfetchsockets

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nicholaswmin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants