Many answers, and the HTTP API — WebSockets · NestJS

Answer one message more than once: an Observable of events, a handler that waits for a promise, an acknowledgement sent by hand before the work is done, and a gateway the HTTP controllers use to tell every socket what changed.

What you will learn

Read the theory for Many answers, and the HTTP API

All WebSockets lessons

All NestJS courses

loading types…

What you'll learn

  • Answer one message with several events by returning an Observable of { event, data }
  • Return a promise from a handler and know the acknowledgement waits for it
  • Acknowledge by hand with @Ack(), and know Nest then ignores the return value
  • Inject a gateway into a controller or service and use its server to tell every socket about a change made over HTTP