How it works...

What we need to keep in mind here from the code we created is that there is ObserveOn and Subscribe. You should not confuse the two. In most cases, when dealing with schedulers, you will use ObserveOn. The ObserveOn method allows you to parameterize where the OnNext, OnCompleted, and OnError messages run. With Subscribe, we parameterize where the actual subscribe and unsubscribe code runs.

We also need to remember that Rx uses the threading timers (System.Threading.Timer) as a default, which is why we encountered the cross-thread violation earlier. As you saw though, we used schedulers to parameterize which timer to use. The way schedulers do this is by exposing three components. These are as follows:

  • The scheduler's ability to perform some action
  • The order in which the action or work to be performed is executed
  • A clock that allows the scheduler to have a notion of time

The use of a clock is important because it allows the developer to use timers on remote machines; for example (where there might be a time difference between you and them), to tell them to perform an action at a particular time.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.66.94