I'm following the most simple tutorials on the internet about how to listen to Server-Sent Events from Javascript:
var es = new EventSource('url')
es.onmessage = function (e) { console.log(e.data) }
But my message
handlers never get called. onopen
and onerror
handlers do get called, Chrome Developer Tools do show a nice "stream" view of the events being sent by the server and if I do the same call from curl
I get a stream of events nicely formatted in the correct way. What could be wrong?