I’m looking to get all individuals socket objects out of io.sockets and iterate over each of them.
Something like:
for (socket in io.sockets.something()) {
// do something with each socket
}
Either I’m doing this wrong or I must be missing something. Thoughts?
The official method is:
Or filter by rooms:
This is advised over the suggestion above as socket.io’s internal data structure could always be subject to change and potentially breaking all your code with future updates. You much less at a risk when you use this
officialmethod.