Hacker News new | ask | show | jobs
by rglover 1622 days ago
There's a (relatively) easy trick for this: Redis pubsub.

When a message comes into an instance, you push it to Redis and have all of your other instances subscribed to it. Messages sync in real-time and the experience is transparent.

I teach the technique here: https://cheatcode.co/courses/how-to-implement-real-time-data...

1 comments

To be a bit clearer, you don't want to push websocket messages per se; eg auth negotiation or info requests. You do want to pubsub out conditioned messages that are generated by any given instance for the purpose of broadcast; eg "userX connected" or "userX said Y".