socket.io-redis-adapter
socket.io-redis-adapter copied to clipboard
A more robust way to gather facts from nodes
I have a local setup with Redis and some application nodes. I have another redis client that is snooping on the channels that the adapter is using.
Whenever I'm snooping I get this error:
Error: timeout reached while waiting for sockets response
I looked into it and this error is because while snooping request.numSub > request.msgCount
since my other client is just a spy. It would be nice if observing the channel didn't break the functionality. Perhaps there could be a way to count participant subs only.
https://github.com/socketio/socket.io-redis-adapter/blob/3242d8e91baf94720df256ab422ec5c037f6a9e1/lib/index.ts#L380-L386
Perhaps there could be a way to count participant subs only.
I'm open to suggestions on this!
I'll think about it a bit and see if I can suggest anything useful.
@darrachequesne, so here's an idea. We can have the "active" participants subscribe to a "proxy" channel when they come online. Nothing actually goes through that particular channel, it's just used for a participant to explicitly mark themselves as a participant.
@doodlesbykumbi that's an interesting idea. That would be a backward incompatible change though, which means users will need to upgrade the whole cluster at the same time, isn't it?
@darrachequesne You can fall back to the request channel for backwards compatibility if desired.
I've created a PR to demonstrate the approach^
Ping @darrachequesne