📜  socket io 获取用户房间 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:07.255000             🧑  作者: Mango

代码示例1
function getUserRooms(socket) {
    return Object.entries(rooms).reduce((names, [name, room]) => {
        if (room.users[socket.id] != null) names.push(name)
        return names
    }, [])
}