@asaje/sse-push-event-server
v1.0.11
Published
## **Description**
Downloads
106
Readme
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',
})