socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Join room doesnt work for namespaced clients Socket.io 1.3.6

Open selay opened this issue 11 years ago • 1 comments

The following example works fine if no namespace or namespace is set to '/'. If you set namespace like '/mynamepsace'. Won't work. socket.join('test room'); console.log(io.sockets.adapter.rooms);

selay avatar Aug 03 '15 08:08 selay

Closing this issue as it is due to the undocumented bad convention rather than coding bug. Rooms added from within namespace is not available in the global namespace, and also its access convention is different. Works as below: Global: io.sockets.adapter.rooms Namespaced: io.of('/yournamespace').adapter.rooms Note: sockets part is omitted in the namespaced version. io.of('/yournamespace').sockets.adapter.rooms won't work, neither will io.adapter.rooms.

selay avatar Aug 03 '15 14:08 selay