Skip to content

Sample Nest JS app to test Server-Sent Events (SSE) to push notifications to UI from API layer without Websockets.

Notifications You must be signed in to change notification settings

tamdilip/sse-nest-js

Repository files navigation

🔔 sse-nest-js

Live demo Gitpod Ready-to-Code

Sample Nest JS app to test Server-Sent Events (SSE) to push unidirectional notifications to UI from API layer without Websockets.

  • UI will subscribe to the Server-Sent Events (SSE) endpoint on the NestJS layer on page load for the specified user id in URL (?userId=2).
  • A corn scheduler is setup on the Nest JS layer for every 2 seconds which will emit message to a random user id.
  • The SSE connection will be destroyed on page unload.

Local setup

        $ git clone https://github.com/tamdilip/sse-nest-js.git
        $ cd sse-nest-js
        $ npm start
        $ Visit in Browser -> http://localhost:3000/?userId=2

Screenshot

Image of Demo App

About

Sample Nest JS app to test Server-Sent Events (SSE) to push notifications to UI from API layer without Websockets.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published