socket.io get rooms which socket is currently in

前端 未结 12 1190
臣服心动
臣服心动 2020-12-14 08:40

Is it possible to get rooms which socket is currently in, without calling

io.sockets.clients(roomName)

for every room name and looking for

12条回答
  •  春和景丽
    2020-12-14 09:01

    Version 2.0.3

    io.sockets.sockets[yourSocketID].rooms
    

    That equal with

    socket.rooms
    

提交回复
热议问题