I'm trying to implement socket.io with Redis adapter in NodeJs.
Mostly it works, but sometimes I am still getting errors when trying to disconnect / connect sockets, so I think I haven't implement it correctly.
Could someone please explain what is the difference between
socket.disconnect();
and io.of('/').adapter.remoteDisconnect();
If I initialise my io with:
io.adapter(redisIO({
host: config.server.redis.host,
port: config.server.redis.port,
requestsTimeout: config.server.redis.request_timeout
}));
Shouldn't then socket.disconnect();
be aware of using redisIO? If using remoteDisconnect
can I still capture socket.on('disconnect', fn)
or should remoteDisconnect
be called in socket.on('disconnect', fn)
?
What happens if client disconnects? How can I propagate it to socket.io cluster?
Any working examples will be appreciated :)
Thanks!