How to use schedulers – subscribeOn and observeOn operators

Now that we have gained some grip on what schedulers are, how many types of schedulers are available, and how to create a scheduler instance, we will focus on how to use schedulers.

There are basically two operators that help us implement schedulers. Up until now, in this chapter, we've used the subscribeOn operator in all the examples with a scheduler; however, there's another operator—observeOn. We will now focus on these two operators, learning how they work, and how they differ.

Let's start with the subscribeOn operator.

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.