Search⌘ K
AI Features

Overview of Subjects in RxJS

Explore the fundamentals of RxJS Subjects, which act as both Observers and Observables to enable multicasting. Understand how Subjects share execution contexts, simplify data distribution among subscribers, and prepare to dive into Behavior, Replay, and Async Subjects in upcoming lessons.

We'll cover the following...

In the previous lesson, we learned how each subscriber invokes the subscribe function of the Observable, which means that it owns an independent execution of that Observable. This is known as a unicast value delivery.

On the other hand, we may need a different approach where the same execution context for an Observable will be shared between every subscriber. This is known as a multicast value delivery.

Subjects are a special type of Observable in RxJS that enable multicasting.

Enter Subjects

A Subject is a special construct in RxJS, which can act as an Observable and an Observer at the same ...