Subscriber
The subscriber represents the end-user. It receives the data at the very end of the stream and acts on it. The action may include updating a user interface, pushing it to another component, or transforming it in any way.
The interface of the subscribers contains four different callbacks, each of which represents a message of some type from the publisher or the subscriber itself:
onSubscribe:
TheonSubscribe
method is invoked as soon as the subscriber has a valid subscription. Generally, this is used to kick-start the delivery of items from the publisher. TheSubscriber
will typically inform thePublisher
here, by requesting another item.onNext:
TheonNext
method is invoked when another item is made available from thePublisher
.onError:
TheonError
method is invoked when an error occurs. This usually means that the subscriber will no longer receive any more messages and should be closed down.onComplete:
TheonComplete
method is invoked by the publisher...