What should I be using? Socket.io rooms or Redis pub-sub?

Redis pub/sub is great in case all clients have direct access to redis. If you have multiple node servers, one can push a message to the others.

But if you also have clients in the browser, you need something else to push data from a server to a client, and in this case, socket.io is great.

Now, if you use socket.io with the Redis store, socket.io will use Redis pub/sub under the hood to propagate messages between servers, and servers will propagate messages to clients.

So using socket.io rooms with socket.io configured with the Redis store is probably the simplest for you.

Leave a Comment