To specify a scheduler on which a subscription is created, handler-executed, and disposed of, we use the subscribeOn operator. This is not normally used; instead, we just use ObserverOn, which specifies the scheduler events: next, error, and completed. The important thing to remember is that subscribeOn will direct which scheduler a subscription operates, whereas ObserveOn will only direct which scheduler to use after or below where ObserveOn is used in a chain. Let's look at this in a marble diagram first and then jump into a code example in the coming section.
We are starting on in the main thread, which is represented by the timeline here:
We will call ObserverOn and specify scheduler1, as shown:
Imagine that we ...