...

/

Subjects and Multicasting Operators

Subjects and Multicasting Operators

Learn about subjects and multitasking operators.

Exploring subjects

Subjects are special types of observables. While plain observables are unicast, subjects are multicast. They allow multicasting values to all the subscribers. We can regard subjects as observers and observables at the same time.

  • We can subscribe to subjects to get emitted values by the producer (that’s why they act as observables).

  • We can send values and errors and complete the stream using the next, error, and complete methods (that’s why they act as observers).

Press + to interact
A reactive architecture involving subjects
A reactive architecture involving subjects

Remember that the observer interface has the next, error, and complete methods to, respectively, send values, error out, and complete an execution. ...