Tokio has two channels for sending updates to multiple receivers. The choice starts with the receiver’s job: does it need the current value, or does it need to handle messages in send order? Tokio’s channel overview describes both patterns.
Use watch for a current value
A watch channel retains only the latest value. Each receiver tracks whether it has seen that value. If several updates arrive while a receiver is busy, it can observe the newest value without observing every intermediate one. That fits a configuration snapshot or a shutdown state. The receiver can catch up by reading what is true now.
A watch channel starts with an initial value. That value is already marked as seen for changed(), including on a newly subscribed receiver. Read it directly with borrow() or borrow_and_update() when starting work; waiting for changed() alone waits for a later send. In a loop that awaits changed(), Tokio recommends borrow_and_update() to avoid processing the same value twice if a send races with the read.
Use broadcast for a stream of messages
A broadcast channel lets each active receiver read sent messages in order. A new subscriber receives messages sent after it subscribes. This suits an event stream where each receiver has a separate reaction to each delivered message.
Capacity matters. Tokio bounds the retained messages. If a receiver falls behind and an old message is overwritten, its next receive reports RecvError::Lagged. The receiver then resumes at the oldest retained message. It must decide whether that gap is acceptable. A larger capacity gives a slow receiver more room, but it does not turn the channel into a durable event history.
What to do
- Write down what a receiver needs after a pause: the latest state or every event.
- Choose
watchfor state, and read its initial value before waiting for changes. - Choose
broadcastfor messages that each active receiver should handle. Set a capacity and handleLaggedexplicitly. - If losing an event would break the task, make recovery from a gap part of the design before relying on
broadcast.

The Campfire
No commentsNobody has pulled up a log by this one yet. Be the first to say what you make of it.
Held for the desk. It appears after a look.