When to multicast
Multicasting is helpful when you need to send the same data to several observers. If the emitted data has to be processed the same way for each of these observers, do it before calling publish(). This prevents redundant work being done by multiple observers. You may do this to increase performance, to reduce memory and CPU usage, or simply because your business logic requires pushing the same emissions to all observers.
Make cold observables multicast only when you are doing so for performance reasons and have multiple observers receiving the same data simultaneously. Remember that multicasting creates hot ConnectableObservables, and you have to be careful and time the connect() call so data is not missed by some observers. ...
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