/eventsource-node

EventSource client for Node.js

Primary LanguageJavaScriptMIT LicenseMIT

Build Status

EventSource

This library implements the EventSource client for Node.js. The API aims to be W3C compatible.

Install

npm install eventsource

Usage

var EventSource = require('eventsource');

es = new EventSource('http://googlecodesamples.com/html5/sse/sse.php');
es.onmessage = function(e) {
    console.log(e.data);
};
es.onerror = function() {
    console.log('ERROR!');
};

See the spec for API docs.

Example

See https://github.com/einaros/sse-example