How can you retrieve all the connected clients in a room using socket.io 2.0
I already tried the solution in a similar question: https://stackoverflow.com/a/45160538/2189845
var sockets = io.in("room_name")
Object.keys(sockets.sockets).forEach((item) => {
console.log("TODO: Item:", sockets.sockets[item].id)
})
But this loops over all socket connections, regardless of the room. So the code above gives the same result as:
Object.keys(io.sockets.sockets).forEach((item) => {
console.log("general socket: Item:", item);
});