lepu-test-platform-web/node_modules/eventsource/example.js

10 lines
224 B
JavaScript

var EventSource = require('./lib/eventsource');
var es = new EventSource('http://demo-eventsource.rhcloud.com/');
es.onmessage = function(e) {
console.log(e.data);
};
es.onerror = function() {
console.log('ERROR!');
};