socket io on connect giving multiple rooms code example
Example 1: socket io join room
socket.join(room)
Example 2: socket io get user rooms
function getUserRooms(socket) {
return Object.entries(rooms).reduce((names, [name, room]) => {
if (room.users[socket.id] != null) names.push(name)
return names
}, [])
}