Saturday 30 April 2016

Socket.io and Redis pub/sub

Hello everyone, me again.TL;DR (There's no long version of this question)I want to use socket.io.I need to run multiple instances on different ports. No problem here.I decided not to use Node's own cluster, I'll use Nginx for load balancing (that's why I create multiple instances of the app). It supports websockets, so this one is also sorted out.I want to use socketio, but there'll be multiple instances, so they can't talk to each other, so I need to use Redis' pub/sub mechanism as a wrapper in order to mimick socketio's emit & broadcast functionality. That way even if I have multiple instances of an app or run it on different servers, everybody will be able to talk to each other as long as they're connected to the same Redis server. To achieve this, I'll need socket.io-redis and socket.io-emitter modules.Have I got that right?

Submitted May 01, 2016 at 01:50AM by laraveling

No comments:

Post a Comment