Quote:
Originally Posted by jefferson
I am currently testing sse, but it doesn't seem to work. It might be some bug on my site, but it works on my desktop browser. Do you maybe still have some code samples which have worked for you?
|
Make sure you aren't using any modern javascript features. ECMAScript 2015 (ES6) is definitely a no go.
I've used the
event field myself. Something like the following worked for me:
Code:
var evtSource = new EventSource("/messages");
evtSource.addEventListener("body", function (event) {
// code goes here
});
Note, using
let for declaring variables is a no-go. Possibly
const as well. To be safe, I'd stick with
var.