Two temperatures of stream
A cold observable starts producing only when someone subscribes, and each subscriber gets its own independent run from the beginning. A hot observable emits whether or not anyone is listening, and late subscribers miss earlier items.
Cold examples
- Reading a file or a database query.
- An HTTP request that fires per subscription.
Two subscribers to a cold stream each trigger a separate request and see the full sequence.
Hot examples
- Mouse events or a stock ticker.
- A message broker topic that is already flowing.
A late subscriber to a hot stream joins midstream and sees only what comes next.
Warming a cold stream
You can share a cold observable so one underlying run feeds many subscribers, converting it to hot. A replay buffer can also give late subscribers the last few items, blending the two behaviors.
Key idea
Cold observables run per subscriber from the start, while hot observables emit live and shared, so late subscribers miss earlier items.