# @asaje/sse-push-event

> ## **Description**

Latest version **1.0.9** (published 2023-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @asaje/sse-push-event
pnpm add @asaje/sse-push-event
yarn add @asaje/sse-push-event
bun add @asaje/sse-push-event
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2023-07-07 |
| First published | 2023-07-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | asaje379 |

## Links

- npm: https://www.npmjs.com/package/@asaje/sse-push-event
- Repository: https://github.com/asaje379/sse-push-event
- Homepage: https://github.com/asaje379/sse-push-event#readme
- Issues: https://github.com/asaje379/sse-push-event/issues
- npm.io page: https://npm.io/package/@asaje/sse-push-event

## Recent versions

- 1.0.9 (latest) — 2023-07-07
- 1.0.8 — 2023-07-07
- 1.0.7 — 2023-07-07
- 1.0.6 — 2023-07-07
- 1.0.5 — 2023-07-07
- 1.0.4 — 2023-07-07
- 1.0.3 — 2023-07-07
- 1.0.2 — 2023-07-07
- 1.0.1 — 2023-07-07

## README

# SSE-PUSH-EVENT

## **Description**

Lightweight package for SSE push events handling

## **Installation**

```bash
npm i @asaje/sse-push-event
```

or

```bash
yarn add @asaje/sse-push-event
```

## **How to use**

### Client Side

```ts
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

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


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

```

---
_Source: https://npm.io/package/@asaje/sse-push-event · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
