Hot vs Cold Streams & Multicasting
Hot vs Cold Streams & Multicasting is the foundational pattern that determines whether each subscription triggers a new upstream execution or shares an existing one. This design choice directly impacts resource usage and stream lifecycle in reactive systems. Cold Observables—like an HTTP call or file read—replay their full producer logic per subscriber, while Hot Observables—such as WebSocket feeds or DOM events—emit independently of listeners and share the same sequence across all subscribers. Kotlin's StateFlow natively replays the latest value, while SharedFlow offers a configurable replay cache. Miswrapping a cold Observable as hot is a common source of subtle bugs, since each subscriber ends up independently triggering the same side effects instead of sharing one execution.
Comments on "Hot vs Cold Streams & Multicasting"
Have a take on this ranking?
Comments are how the argument actually happens here. Posting one needs a free account — it takes about a minute.
No comments yet.
The first comment sets the terms of the argument.