@asaje/sse-push-event-server
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

SSE-PUSH-EVENT

Description

Lightweight package for SSE push events handling

Installation

npm i @asaje/sse-push-event-server

or

yarn add @asaje/sse-push-event-server

How to use

// Example of NestJS controller
@Sse('events')
connectSse(@Res() res: Response) {
  const { value, destroy } = initPushEventSubscription();
  res.on('close', () => {
    destroy();
  });

  return value;
}


// Sending event
sendPushEvent({
  event: 'TEST',
  data: { msg: 'Hello' },
  room: 'test-room',
})

Readme

Keywords

none

Package Sidebar

Install

npm i @asaje/sse-push-event-server

Weekly Downloads

9

Version

1.0.11

License

MIT

Unpacked Size

4.16 kB

Total Files

8

Last publish

Collaborators

  • asaje379