The cross node problem
In a realtime app each connection node holds only the clients connected to it. When a user on node one messages a user on node two, node one has no direct path. A message broker is the shared backbone that relays between nodes.
How it works
- Every node subscribes to the broker for the channels its clients care about.
- When a message arrives, the node publishes it to the broker channel.
- The broker delivers it to every node subscribed, which then pushes to its local clients.
What the broker provides
- A decoupling layer so nodes never connect directly to each other.
- Channels that map naturally to rooms or topics.
- A buffer that smooths bursts between nodes.
Watch out for
- The broker can become a bottleneck, so partition busy channels across broker shards.
- Decide a delivery guarantee; many realtime brokers favor speed over durability.
Key idea
A realtime message broker is the shared backbone that relays messages between connection nodes through subscribed channels, so a client on one node can reach a client on any other.