ConnectableFlowable

So far, in this chapter, we've dealt with Cold Observables. What if we want to deal with hot source? Every type of Observable has their counterpart in Flowable. In the previous chapter, we started hot source with ConnectableObservable, so let's start with ConnectableFlowable.

As with Observable, ConnectableFlowable resembles an ordinary Flowable, except that it does not begin emitting items when it is subscribed, but only when its connect() method is called. In this way, you can wait for all intended Subscribers to Flowable.subscribe(), before Flowable begins emitting items. Please refer to the following code:

    fun main(args: Array<String>) { 
      val connectableFlowable = listOf ("String 1","String 2","String 3","String 4", ...

Get Reactive Programming in Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.