← Lessons

quiz vs the machine

Gold1500

Concurrency

The Cold versus Hot Observables

Per subscriber streams versus shared live streams.

5 min read · core · beat Gold to climb

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.

Check yourself

Answer to earn rating on the learn ladder.

1. When does a cold observable begin producing items?

2. What does a late subscriber to a hot observable see?