observable-event-source

1.0.1 • Public • Published

observable-event-source

RxJS Observable from server sent event stream

js-standard-style

this is not production quality software and is supported only on a best-effort basis through github, use at your own risk

usage

const observableEventSource = require('observable-event-source')
const o = observableEventSource({
  url: 'https://skimdb.npmjs.com/registry/_changes?since=742000&feed=eventsource',
  json: true
})
 
console.log('recently changed npm packages...')
o.map(function (update) {
  return update.id
}).subscribe(console.log)

api

observableEventSource(options: Object) => Observable<String|Object>

Options:

  • url:String, required - location of the Server-Sent Events feed
  • json:Boolean, default false - if true, event data is parsed as JSON

Returns an instance of Observable, which has all kinds of features that are beyond the scope of this readme.

Each SSE data: item is returned as en element of the observable sequence. Event names are ignored in this version.

installation

$ npm install observable-event-source

running the tests

From package root:

$ npm install
$ npm test

contributors

license

ISC. (c) MMXVI jden jason@denizac.org. See LICENSE.md

Dependents (0)

Package Sidebar

Install

npm i observable-event-source

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators