Closed
Description
In 1.x the difference between Observer and Subscriber is that a Subscriber allows to subscribe and unsubscribe, however an Observer only allows to subscribe.
But in 2.x Observer is used to subscribe to an Observable, and Subscriber is used to subscribe to a Flowable. And if you want to be able to unsubscribe, you need to use ResourceObserver and ResourceSubscriber respectively.
Is that right?
Thanks.
Activity
akarnokd commentedon Sep 8, 2016
Yes.
ScottCooper92 commentedon Mar 1, 2017
Hi, I realise this is an old issue but I'd like some further clarification.
The distinction between a Subscriber and an Observer is that Subscribers are part of the Reactive Stream specification, where the first rule of Subscribers is that they must "MUST signal demand via Subscription.request(long n) to receive onNext signals."
Since Observables don't have backpressure support, and therefore don't signal demand via request(long n), they use Observer, which doesn't have the request method.
Am I on the right track?
akarnokd commentedon Mar 1, 2017
Since
Observable
s don't have backpressure support, there is no need for aSubscription
with arequest()
method. To avoid some confusion, separate "connection" types is employed:Disposable
with adispose()
method that is analogous toSubscription.cancel()
.