serversentevents

0.0.4 • Public • Published

Build Status

serversentevents

Lightweight tool for building strings for Server-Sent Events.

Usage

Create a string like this:

var sse = require('serversentevents').sse
 
var s = sse()
  .event('update')
  .data({ prop : 'something' }) // serialized to JSON
  .id(57)
  .retry(10000)
  .comment('a comment')
  .toString()
 
// event:update
// id:57
// retry:10000
// comment:a comment
// data:{"prop":"something"}

Then pass it along to res.write().

Check out the examples folder for a full server and client example.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i serversentevents

Weekly Downloads

9

Version

0.0.4

License

MIT

Last publish

Collaborators

  • rsolomo