serversentevents
v0.0.4
Published
Lightweight tool for building strings for Server-Sent Events.
Downloads
5
Readme
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