0.0.4 • Published 11 years ago

serversentevents v0.0.4

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

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

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago