Welcome Guest! (App Version 3.1)

websitnero logo name

Server Side Events

Server Side Events in HTML5

This feature is used to send the updates selectively to the end user. Like when you are on facebook, you will see the red numbers on the top showing the messages or updates for a particular user. Similarly, you get the same updates on twitter or other websites that depend on SSE to send similar updates to the users thereby providing him the real time updates pretty fast. This is a very useful feature just like websockets but only one-way data transmission is possible, ie, from server to the client.


<p id="para1"></p>


if(typeof(EventSource) !== "undefined") {
  var sse = new EventSource("sse.php");
  sse.onmessage = function(event) {
    document.getElementById("para1").innerHTML += event.data + "<br>";




header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');

$time = date('r');
echo "data: The server time is: {$time}\n\n";

WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.