HTML5 - Introduction
HTML5 - New Elements
HTML5 - Removed Elements
HTML5 - Browser Check
Tag Name : server-sent-events
The 'Server Sent Events' a.k.a SSEs crosses into the scripting world. SSEs enable a web page receive messages 'automatically' from a server based backend script. This backend script could be a PHP, ColdFusion, .net, Java or any web technology based script.
The emphasis is to be placed on the word 'automatically'. The web page does not need to have any explicit code to issue calls to the back end server based script and ask for updates (messages).
HTML Example :

Server sent time : <div id=msg></div>

var server_resource=new EventSource("t_sse_resource.php");

Server Side Script code [t_sse_resource.php) :

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

$time = date('h:i:s');
echo "data: {$time}\n\n";

© 2010 All rights reserved. |