In a recent article in which I wrote about the HTML 5 draft, I mentioned a server notifications API and hinted that it will standardize a technique known as Comet. So what is Comet anyway?
Comet is an event driven communication scheme with between a web-browser and a web-server. In the normal flow of an http request, a web server can not initiate communications with the client (the web browser) - it can only respond to requests. Comet declares a reversal of roles, in which the server can notify the client whenever new data is available. This technique is very useful in a constantly changing environment such as stock prices or online messaging (chat).
The term was coined by Alex Russell of Dojo fame, in a blog piece a little more than two years ago. It has since gained minor traction in the development community, with several projects actively promoting it and educating on it. It never reached AJAX-levels in popularity though, mainly due to it being somewhat difficult to implement and use.
Enter HTML 5. The working draft of the HTML 5 specifications declares server-sent DOM events. This API allows for native implementation of Comet techniques without using elaborate client-server setups which will finally make Comet accessible enough to be considered mainstream. The specs go even further, and declare an interface for bidirectional communications between client and server and client and client (P2P). Such an interface would render current AJAX techniques absolute, as the XHR object would no longer be required to poll the server for data on demand. The peer-to-peer options offer an incredible opportunity to multi-user environment by removing the server as the middle-man (and the bottleneck).
Comet Daily gives an overview of this API and the WebSockets API in a recent piece. Michael Carter mentions the new network API and how it will affect future client-server communication in some detail and even shows some mock code of ridiculously simple setup for server-listening events.
So yeah, HTML 5 is definitely something to watch for. Hopefully the draft will be finalized as soon as possible so browser vendors could start pushing out implementations and make us developers very happy.
To know when the next article is published, please subscribe to new articles using your Email below or follow me on Twitter.