Cold vs Hot Observables
Observables
can be classified into two main groups: hot and cold Observables
. Let's start with a cold Observable
.
In the above case subscriber B subscribes 2000ms after subscriber A. Yet subscriber B is starting to get values like subscriber A only time shifted. This behavior is referred to as a cold Observable
. A useful analogy is watching a pre-recorded video, such as on Netflix. You press Play and the movie starts playing from the beginning. Someone else can start playing the same movie in their own home 25 minutes later.
On the other hand there is also a hot Observable
, which is more like a live performance. You attend a live band performance from the beginning, but someone else might be 25 minutes late to the show. The band will not start playing from the beginning and the latecomer must start watching the performance from where it is.
We have already encountered both kind of Observables
. The example above is a cold Observable
, while the example that uses valueChanges
on our text field input is a hot Observable
.
Last updated