1.0.9 • Published 10 months ago

@asaje/sse-push-event v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

SSE-PUSH-EVENT

Description

Lightweight package for SSE push events handling

Installation

npm i @asaje/sse-push-event

or

yarn add @asaje/sse-push-event

How to use

Client Side

import {
  addPushEventListener,
  initPushEvent,
  joinPushEventRoom,
} from '@asaje/sse-push-event';

initPushEvent('http://localhost:3000/events');

joinPushEventRoom('test-room');

addPushEventListener('TEST', (data) => {
  console.log('Received: ', data);
});

Server Side

// Example of NestJS controller
@Sse('events')
notify(): Observable<any> {
  return initPushEventSubscription();
}


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

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago