TODO: Investigate this approach suggested by the creator of Monix:
You can cache the last emitted value by doing a
observable.multicast(Pipe.behavior(initial)),
which has a shortcut, so you can do observable.behavior(initial).
As the name suggests, this turns your source into a multicast / hot data-source,
meaning that it gets shared between multiple subscribers,
hence the returned type is ConnectableObservable,
which requires a .connect() in order to actually start the source.
CurrentValueSubscriber
TODO: Investigate this approach suggested by the creator of Monix:
You can cache the last emitted value by doing a observable.multicast(Pipe.behavior(initial)), which has a shortcut, so you can do observable.behavior(initial).
As the name suggests, this turns your source into a multicast / hot data-source, meaning that it gets shared between multiple subscribers, hence the returned type is ConnectableObservable, which requires a .connect() in order to actually start the source.