1

BEFORE YOU MARK THIS QUESTION AS A DUPLICATE THERE IS ONE REQUIREMENT!

It needs to work with multiple servers (i.e. socket.io-redis) and it needs to work with socket.io version 1.2.1. Similar questions such as Socket.io disconnect client by id or SocketIO: disconnect client by socket id? do not fufill both of those requirements.

Community
  • 1
  • 1
David L. Rodgers
  • 1,031
  • 1
  • 8
  • 18
  • Am I correct that `io.sockets.connected[socketId].disconnect();` will disconnect the `socketID` from that specific instince of `io`? – Ryder Brooks Jan 13 '15 at 22:43
  • @user3204587 yes but such a solution does not work when you have multiple servers behind a load balancer as the command does not seem to be sent to redis. – David L. Rodgers Jan 13 '15 at 22:44
  • I understand. I just wanted to make sure that multiple servers was the real issue here. You either need to use the socket.io-redis api via `subClient/pubClient` or you need to implement a messaging layer. (if this is not news to you then please be more specific as to your confusion with this process) – Ryder Brooks Jan 13 '15 at 22:56
  • @user3204587 Already implemented redis, I use it for emit events. Still doesn't seem to work with disconnecting. – David L. Rodgers Jan 14 '15 at 07:03
  • I'm not trying to be rude, but you really need to be more specific. When redis emits your disconnect event is it received by all your servers? Or is the issue that the client remains connected after `.disconnect()` is called? – Ryder Brooks Jan 14 '15 at 15:47

0 Answers0