# event-source-stream

> EventSource implemented in node as a readable stream

Latest version **1.6.0** (published 2018-05-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install event-source-stream
pnpm add event-source-stream
yarn add event-source-stream
bun add event-source-stream
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.0 |
| Published | 2018-05-29 |
| First published | 2014-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 47 |
| Author | Mathias Buus |
| Maintainers | mafintosh |
| Keywords | event, source, stream, client, readable, html5 |

## Links

- npm: https://www.npmjs.com/package/event-source-stream
- Repository: https://github.com/mafintosh/event-source-stream
- Issues: https://github.com/mafintosh/event-source-stream/issues
- npm.io page: https://npm.io/package/event-source-stream

## Dependencies (4)

- [once](https://npm.io/package/once.md) ^1.3.1
- [split2](https://npm.io/package/split2.md) ^0.1.2
- [request](https://npm.io/package/request.md) ^2.36.0
- [readable-stream](https://npm.io/package/readable-stream.md) ^2.2.2

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.6.0 (latest) — 2018-05-29
- 1.5.0 — 2016-03-14
- 1.4.0 — 2016-02-18
- 1.3.2 — 2015-05-08
- 1.3.1 — 2015-05-02
- 1.3.0 — 2015-04-26
- 1.2.0 — 2015-04-16
- 1.1.1 — 2014-10-23
- 1.1.0 — 2014-06-17
- 1.0.0 — 2014-06-17

## README

# event-source-stream

[EventSource](https://developer.mozilla.org/en-US/docs/Server-sent_events/Using_server-sent_events) implemented in node as a readable stream

``` js
npm install event-source-stream
```

[![build status](http://img.shields.io/travis/mafintosh/event-source-stream.svg?style=flat)](http://travis-ci.org/mafintosh/event-source-stream)
![dat](http://img.shields.io/badge/Development%20sponsored%20by-dat-green.svg?style=flat)

## Usage

``` js
var ess = require('event-source-stream')

ess('http://server-sent-events-demo.herokuapp.com/update')
  .on('data', function(data) {
    console.log('received event:', data)
  })
```

Per default it will retry after 3s when the connection terminates. Change this by setting the `retry` option

``` js
// no retries
ess('http://server-sent-events-demo.herokuapp.com/update', {retry:false}).pipe(...)

// retry after 10s
ess('http://server-sent-events-demo.herokuapp.com/update', {retry:10000}).pipe(...)
```

## Browser support

It also works in the browser using browserify

``` js
var ess = require('event-source-stream') // will use EventSource behind the scene

ess('http://server-sent-events-demo.herokuapp.com/update')
  .on('data', function(data) {
    console.log('recevied event in the browser', data)
  })
```

## License

MIT

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