Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get list of sockets in the same room when using redis as the adapter (multiple socket.io instances) #2429

Closed
spinwang opened this issue Feb 4, 2016 · 1 comment
Labels
enhancement New feature or request

Comments

@spinwang
Copy link

spinwang commented Feb 4, 2016

I have socket.io running on multiple servers and uses redis as the adapter. I am trying to access all the sockets in one room and see if the room is empty, but I couldn't find all the sockets connected to different servers, though they are in the same room.

var io
io = socket_io(server);
io.adapter(redis({ host: 'localhost', port: 6379 }));
io.nsps['/'].adapter.rooms[roomName] #returns undefined 

# this doesn't work either, always complain 'clients' is undefined, thus can't be used as a function
io.of('/').in(roomName).clients(function(error, clients){
    if (error) throw error;
    console.log(clients); 
  });
@darrachequesne darrachequesne added enhancement New feature or request Redis-adapter labels Nov 28, 2016
@darrachequesne
Copy link
Member

Fixed now thanks to socketio/socket.io-redis-adapter#109 (and released as 1.1.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants