You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My team runs multiple servers and uses https://github.com/socketio/socket.io-redis-adapter to ensure messages can be delivered to all clients, no matter which server they're actually connected to. Recently, we got reports from users that updates were not in fact being delivered successfully to clients. After a solid day of debugging, we discovered that our Redis clients were unexpectedly disconnecting from the Redis server. We use node-redis as our Redis client, and by default it should reconnect to the Redis server. It was in fact reconnecting, but after reconnecting, it failed to re-establish the subscription.
This appears to be a well-documented problem with node-redis specifically:
When reconnected, the client will auto subscribe to channels that the previous connection subscribed to.
Given that socket.io's Redis adapter relies almost exclusively on pub/sub capabilities of Redis clients, I'd like to propose that socket.io remove node-redis from its documentation in favor of recommending just ioredis. At the very least, a warning about this issue with node-redis should be added.
My team runs multiple servers and uses https://github.com/socketio/socket.io-redis-adapter to ensure messages can be delivered to all clients, no matter which server they're actually connected to. Recently, we got reports from users that updates were not in fact being delivered successfully to clients. After a solid day of debugging, we discovered that our Redis clients were unexpectedly disconnecting from the Redis server. We use
node-redis
as our Redis client, and by default it should reconnect to the Redis server. It was in fact reconnecting, but after reconnecting, it failed to re-establish the subscription.This appears to be a well-documented problem with
node-redis
specifically:Other folks have moved off
node-redis
toioredis
because of this (see mastodon/mastodon#25157).ioredis
explicitly documents that they restore subscriptions after reconnecting:Given that socket.io's Redis adapter relies almost exclusively on pub/sub capabilities of Redis clients, I'd like to propose that
socket.io
removenode-redis
from its documentation in favor of recommending justioredis
. At the very least, a warning about this issue withnode-redis
should be added.For reference, here's where this is currently documented: https://socket.io/docs/v4/redis-adapter/.
Perhaps I should have filed this in https://github.com/socketio/socket.io-website. Let me know if that's the case and I can move the issue there.
The text was updated successfully, but these errors were encountered: