You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<spanclass="operator">ObserveOn</span> instructs an Observable to call its observer’s
19
-
<code>onNext</code>, <code>onError</code>, and <code>onCompleted</code> methods on a particular Scheduler;
20
-
<spanclass="operator">SubscribeOn</span> takes this a step further and instructs the Observable to do all of
21
-
its processing (including the sending of items and notifications to observers) on a particular Scheduler.
22
14
</p>
15
+
<figure>
16
+
<figcaption><p>
17
+
By default, an Observable and the chain of operators that you apply to it will do its work, and will notify
18
+
its observers, on the same thread on which its <code>Subscribe</code> method is called. The
19
+
<spanclass="operator">SubscribeOn</span> operator changes this behavior by specifying a different Scheduler
20
+
on which the Observable should operate. The <spanclass="operator">ObserveOn</span> operator specifies a
21
+
different Scheduler that the Observable will use to send notifications to its observers.
22
+
</p><p>
23
+
As shown in this illustration, the <spanclass="operator">SubscribeOn</span> operator designates which thread
24
+
the Observable will begin operating on, no matter at what point in the chain of operators that operator is
25
+
called. <spanclass="operator">ObserveOn</span>, on the other hand, affects the thread that the Observable
26
+
will use <em>below</em> where that operator appears. For this reason, you may call
27
+
<spanclass="operator">ObserveOn</span> multiple times at various points during the chain of Observable
28
+
operators in order to change on which threads certain of those operators operate.
29
+
</p></figcaption>
30
+
<imgsrc="operators/images/schedulers.png"style="width:100%;"alt="ObserveOn and SubscribeOn" />
31
+
</figure>
32
+
23
33
<h4>See Also</h4>
24
34
<ul>
25
35
<li><ahref="http://www.introtorx.com/Content/v1.0.10621.0/15_SchedulingAndThreading.html"><cite>Introduction to Rx</cite>: Scheduling and Threading</a></li>
0 commit comments