GoScrobble/web/node_modules/eventsource/example/sse-client.js

6 lines
161 B
JavaScript

var EventSource = require('..')
var es = new EventSource('http://localhost:8080/sse')
es.addEventListener('server-time', function (e) {
console.log(e.data)
})