The replay() operator is a powerful way to hold onto previous emissions and re-emit them when a new Observer comes in. It returns ConnectableObservable, which both multicasts emissions and emits previous emissions. It emits the cached values immediately when a new Observer subscribes so it is caught up, and then it fires current emissions from that point forward.
Let's start with a replay() with no arguments. This will replay all previous emissions to tardy observers and then emit current emissions as soon as the tardy Observer is caught up. If we use Observable.interval() to emit every second, we can call replay() on it to multicast and replay previous integer emissions. Since replay() returns ConnectableObservable, let's use ...