Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
    }, [])
}
 
PREVIOUS NEXT
Tagged: #socket #io #user #rooms
ADD COMMENT
Topic
Name
4+2 =