Server-Sent Events — Techniques · NestJS

Push adoptions to clients as they happen: a replaying stream of events in the service, an @Sse() route that merges it with a heartbeat, and the text/event-stream wire format Nest writes for you.

What you will learn

Read the theory for Server-Sent Events

All Techniques lessons

All NestJS courses

loading types…

What you'll learn

  • Write an @Sse() handler that returns an Observable<MessageEvent>, and read the event-stream lines it produces
  • Merge domain events from a subject with a periodic heartbeat, and explain what happens when the client disconnects
  • Choose ReplaySubject, BehaviorSubject or Subject by what a late subscriber should see