RemoteDisconnect socket.io and redis
I am trying to implement socket.io with Redis adapter in NodeJs.
It mostly works, but sometimes I still get errors when trying to disconnect / connect sockets, so I think I haven't implemented it correctly.
Can someone please explain what is the difference between
socket.disconnect();
andio.of('/').adapter.remoteDisconnect();
If I initialize my io with
io.adapter(redisIO({
host: config.server.redis.host,
port: config.server.redis.port,
requestsTimeout: config.server.redis.request_timeout
}));
Shouldn't you then socket.disconnect();
know the use of redisIO? If on use remoteDisconnect
I can capture socket.on('disconnect', fn)
or should I be remoteDisconnect
called in socket.on('disconnect', fn)
?
What happens if a client disconnects? How can I propagate it to socket.io cluster?
Any working examples would be appreciated :)
Thank!
source to share