http-sse
v1.0.0
Published
Create server-sent-events
Downloads
3
Readme
http-sse
Create server-sent-events
Usage
var Sse = require('http-sse')
var http = require('http')
http.createServer(function (req, res) {
var sse = Sse(req, res)
sse.write('foo', 'bar')
sse.write('bin', 'baz')
sse.end('beep', 'boop')
})
API
sse = Sse(req, res)
Create a new SSE instance.
sse.write(name, data)
Write a new message to the SSE stream.
sse.end([name], [data])
Close the SSE stream.
See Also
- https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events