1.1.0 • Published 10 years ago

fromeventsource v1.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

fromeventsource

Install with npm install fromeventsource

Turns EventSource into and readable object stream. It expects each message to be valid JSON.

It disables the reconnection of EventSource and only supports unnamed messages right now (onmessage). However PRs to enable this functionality are welcome.

usage

var fromEventSource = require('fromeventsource')

fromEventSource(new EventSource('/sse'))
  .pipe(process)

or just pass in a string:

var fromEventSource = require('fromeventsource')

fromEventSource('/sse')
  .pipe(process)