Changing thread on subscription – subscribeOn operator

We need to understand how the Observable works before delving any further in how to use scheduler. Let's take a look at the following graphics:

As the preceding image depicts, it's the threads that are responsible for carrying items from the source all the way to the Subscriber through operators. It may be a single thread throughout the subscription, or it may even be different threads at different levels.

By default, the thread in which we perform the subscription is the responsible of bringing all the emissions down to the Subscriber, unless we instruct it otherwise.

Let's take a look ...

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.