Enter your email id to get regular update free
Your Email

What is SSE in HTML5?

Server-Sent Events allow a web page to get updates from a server.

A server-sent event is when a web page automatically gets updates from a server. This was also possible before, but the web page would have to ask if any updates were available. With server-sent events, the updates come automatically.
Receive Server-Sent Event Notifications
var source = new EventSource("demo_sse.php");
source.onmessage = function(event)
 document.getElementById("result").innerHTML += event.data + "
Create a new EventSource object, and specify the URL of the page sending the updates .
 Each time an update is received, the onmessage event occurs.
When an onmessage event occurs, put the received data into the element with id="result"
To check Server-Sent Events Support
if(typeof(EventSource) !== "undefined")
 // Server-sent events supported     // Some code..... }
 else {
 // No server-sent events support. 
server-sent event
Tech writer at newsandstory
Total 612 views