title: Server-sent event received after 3-4 seconds
body: <p>While reading about Server-Sent Events from <a href="http://www.w3schools.com/html/html5_serversentevents.asp" rel="nofollow">this page</a>, I got confused about the timing of events. Basically, the <a href="http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_sse" rel="nofollow">example shown</a> has a PHP script sending the system time to the web page:</p>
  
  <pre><code>&lt;?php
      header('Content-Type: text/event-stream');
      header('Cache-Control: no-cache');
  
      $time = date('r');
      echo "data: The server time is: {$time}\n\n";
      flush();
  ?&gt;
  </code></pre>
  
  <p>While the page receives and renders it:</p>
  
  <pre><code>if(typeof(EventSource) !== "undefined") {
      var source = new EventSource("demo_sse.php");
      source.onmessage = function(event) {
          document.getElementById("result").innerHTML += event.data + "&lt;br&gt;";
      };
  } else {
      document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";
  }
  </code></pre>
  
  <p>My confusion is that the server seems to be sending messages every 3-4 seconds:</p>
  
  <pre><code>The server time is: Tue, 20 Sep 2016 11:55:12 -0400
  The server time is: Tue, 20 Sep 2016 11:55:16 -0400
  The server time is: Tue, 20 Sep 2016 11:55:20 -0400
  The server time is: Tue, 20 Sep 2016 11:55:23 -0400
  The server time is: Tue, 20 Sep 2016 11:55:28 -0400
  The server time is: Tue, 20 Sep 2016 11:55:32 -0400
  The server time is: Tue, 20 Sep 2016 11:55:35 -0400
  The server time is: Tue, 20 Sep 2016 11:55:39 -0400
  The server time is: Tue, 20 Sep 2016 11:55:43 -0400
  The server time is: Tue, 20 Sep 2016 11:55:46 -0400
  The server time is: Tue, 20 Sep 2016 11:55:50 -0400
  The server time is: Tue, 20 Sep 2016 11:55:53 -0400
  The server time is: Tue, 20 Sep 2016 11:55:57 -0400
  The server time is: Tue, 20 Sep 2016 11:56:01 -0400
  The server time is: Tue, 20 Sep 2016 11:56:04 -0400
  The server time is: Tue, 20 Sep 2016 11:56:08 -0400
  The server time is: Tue, 20 Sep 2016 11:56:12 -0400
  The server time is: Tue, 20 Sep 2016 11:56:15 -0400
  </code></pre>
  
  <p>However, I don't see this delay either at the server end or at the client end. Is it the network lag between the website's server and my browser? Or is it something else?</p>