Server-Sent Events
Receive Server-Sent Event Notifications
var source = new EventSource("http://localhost:8080/handler");
source.onmessage = function(event) {
document.getElementById("result").innerHTML += event.data + "<br>";
};Check Server-Sent Events Support
if(typeof(EventSource) !== "undefined") {
// Yes! Server-sent events support!
// Some code.....
} else {
// Sorry! No server-sent events support..
}Server-Side Code Example
Last updated
Was this helpful?