← Lessons

quiz vs the machine

Gold1510

System Design

The Message Broker for Realtime

Using a broker as the backbone that relays messages between connection nodes so any client can reach any other.

5 min read · core · beat Gold to climb

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.

Check yourself

Answer to earn rating on the learn ladder.

1. What problem does a realtime message broker solve?

2. How does a node receive a message meant for one of its clients?