LiveLoveApp logo

Subject Variants

Goals

  • Learn the subclasses (or variants) of Subject.
  • Learn to use the AsyncSubject.
  • Learn to use the BehaviorSubject.
  • Learn to use the ReplaySubject.
  • Learn to use the WebSocketSubject.

Subject Subclasses

The Subject class has several subclasses that each provide unique functionality, and often, unique timings of the notifications emitted to Observers. In this chapter we'll explore each of the Subject subclasses in detail.

Use Cases

For some variants of the Subject you will very quickly identify potential use cases. For other variants, you may not be able to identify a potential use case.

I'm with you on this. I've been using RxJS for many years; for fun, for study, and for clients and professional engagements. A few of these variants I have never used.

With that said, I think its important for us to learn each one. So if, and maybe when, the use case comes along and presents itself to us, we'll be well-equipped to use the right tool (or Subject in this case).