event-source-emitter
Server-side events with EventSource.
Example
var http = eventSource = http
$ curl -v 127.0.0.1:8765
To connect to the EventSource server, use the browser's EventSource interface.
API
EventSource(req, res, {keepAlive, onClose})
keepAlive
- Boolean, default:false
. Iftrue
, send a comment every 15 seconds to guard against timeouts.onClose
- Function, called when the connection is terminated.
EventSource.emit(event, data)
Send an event down the event stream.
EventSource.end()
Close the connection.
EventSource.comment(text)
Send a message down the event stream. It will be ignored by the receiver.