Roundup - Comet Tutorials, Examples and Resources
I've been collecting resources recently for Comet and Cometd. Just a reminder on what Comet is:
Fundamentally, [Comet applications] use long-lived HTTP connections to reduce the latency with which messages are passed to the server. In essence, [Comet applications] do not poll the server occasionally. Instead the server has an open line of communication with which it can push data to the client.
Cometd (originally call "Shortbus") is an attempt to standardize Comet as a protocol with a reference implementation. The protocol, Bayeux, runs on top of the server push to allow pub sub subscribe to events, sort of like a JMS for Javascript.
I've tried to focus here on resources that explain the nitty-gritty of streaming to the browser. Unfortunately there aren't a whole lot of tutorials of this sort. There are, however, a ton of libraries, tools and frameworks out there that abstract the basics, and I'll cover those in a future post.
Tutorials and Examples
- gCometd: an example introducing Cometd, Bayeux using Grizzly, the Glassfish NIO HTTP listener.
- Pageview counter Comet example. Probably the most understandable of all the tutorials.
- Michael Mahemoff's post on portable Comet using Iframes.
- java.net tutorial on doing "Reverse Ajax" with DWR, which includes Comet as one of three approaches.
Resources
- Of course the Cometd home page. Still a little light on information.
- Michael Mahemoff's page from his ajaxpatterns Wiki explaining HTTP Streaming
- Alex Russell's (of Dojo) intro to Comet.
- An analysis by Alex Russell of the GTalk interface in GMail. Good analysis of the low level support for streaming HTTP in the browser.
- An old but still good blog entry by John Resig on HTTP Streaming and how it works.
- Pushlets, an early form of comet.

Comments