In the previous chapter, we created Observables from the scratch and subscribed to those Observables. In all of our examples, the Observables created an instance of the (data) Producer class. The Producer class produces an event Stream. In other words, Observables are functions that connect Subscribers (Observers) to Producers.
Before we proceed, let's dissect an Observable and the core activities related to it:
- An Observable is a function that takes an Observer as a parameter and returns a function
- An Observable connects an Observer to a Producer (Producer is opaque to the Observer)
- A Producer is a source of values for an Observable
- An Observer is an object that has the on_next, on_error, and on_completed methods