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:TheonSubscribemethod 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. TheSubscriberwill typically inform thePublisherhere, by requesting another item.onNext:TheonNextmethod is invoked when another item is made available from thePublisher.onError:TheonErrormethod 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:TheonCompletemethod is invoked by the publisher...