question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get all the rooms

See original GitHub issue

#1630 already adds support for .clients([room], fn); to grab a list of socket ids in a room. I sent a PR to @FREEZX for adding the method .roomClients([socketid],fn) as well to grab a list of rooms the socket id is in.

This was possible in 0.9.x with io.sockets.manager.roomClients[socket_id] and it used to work across multiple nodes when used with RedisStore.

It was also possible to get a hash of all the rooms with io.sockets.manager.rooms but I don’t see this available in 1.x. There is io.sockets.adapter.rooms but that doesn’t work across nodes as far as I can see.

It is possible to get this data using the above two functions. First get all socket ids in room ‘’ then call roomClients repeatedly to get the rooms and merge those but it means making n calls to roomClients, where as it was as simple as reading the io.sockets.manager.rooms object in 0.9.x

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:2
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
wangdalangcommented, Sep 29, 2018

i use io.sockets.adapter.rooms

0reactions
Noitidartcommented, Sep 20, 2019

@wangdalang can you please show code example and link to docs for that. I can’t seem to find it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to list rooms on socket.io nodejs server - Stack Overflow
You can get all sockets in a specific room using followings 3. socket.adapter.rooms; io.sockets.adapter.rooms io.sockets.adapter.sids.
Read more >
AllTheRooms | Free Tools For Vacation Rental Hosts
Free tools for short-term rental hosts. Sign up now for access to our short-term rental analytics and commission-free bookings.
Read more >
Rooms | Socket.IO
A room is an arbitrary channel that sockets can join and leave. It can be used to broadcast events to a subset of...
Read more >
Rooms - Binding of Isaac: Rebirth Wiki - Fandom
These Rooms are 2 Rooms wide and have 5 shop items that can all be bought for 1 heart container, like devil deals....
Read more >
Getting list of all rooms - Power Platform Community - Microsoft
Solved: Hi all, I want to get a list of all rooms / resources. On the main screen in the onStart property I've...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found