A cold Observable
A cold Observable is much like a music CD that is provided to each listener, so each person can hear all the tracks any time they start listening to it. In the same manner, a cold Observable replays the emissions to each Observer, ensuring that it gets all the data. Most data-driven observables are cold, and this includes the observables produced by the Observable.just() and Observable.fromIterable() factories.
In the following example, we have two observers subscribed to one Observable. The Observable first pushes all the emissions to the first Observer and then calls onComplete(). Then, it pushes all the emissions again to the second Observer and calls onComplete(). Both observers receive the same datasets by getting two ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access