3
What is SSE in HTML5? And also describe the concept, how to automatically gets update a webpage from a server?
What is SSE in HTML5? And also describe the concept, how to automatically gets update a webpage from a server?

Content-Type:text/event-stream
Cache-control:no-cache
<html>
<head><title> SSE Example</title>
<script>
function check_updates()
{
if(typeof(EventSource) !== "undefined") {
var source = new EventSource("server.php");
source.onmessage = function(event) {
document.getElementById("result").innerHTML += event.data + "<br>";
};
} else {
document.getElementById("result").innerHTML = "Sorry, Your Browser doesn't support SSE...";
}
}
</script>
</head>
<body onload="check_updates();">
<h1>Get the updates from a Server</h1>
<div id="result"></div>
</body>
</html>
<?php
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
$currentTime = date('r');
echo "data:Now, The server time is: {$ currentTime } \n"; flush();
?>
<%
Response.ContentType = "text/event-stream"
Response.Expires = -1
Response.Write("data:Now The server time is: " & now())
Response.Flush()
%>