Comet

A couple of weeks ago I learned about a new technology (actually a new name for an old technology) called Comet. But I didn’t catch the parallel to Ajax — they’re both names for household cleaners (duh) — until I was talking with Phil yesterday.

The heart of AJAX is the XMLHTTPRequest object that sits in a user’s browser. This object can make its own connections to web servers, allowing content to be downloaded and refreshed on the screen based on an event in the browser. For example, if you zoom or pan a Google Map, the XMLHTTPRequest object downloads a new set of images for the map, without reloading the page.

Comet is similar, allowing content to be refreshed without reloading the page. But Comet doesn’t require an event to occur on the user’s end. Gmail’s embeddded chat is an application of Comet. The server can push content (in this case, new chat conversations) to the client at will.

The secret behind Comet is an embedded iframe through which a connection to the server remains continously open. This takes some extra tweaking of the server, but Comet connections don’t have the overhead of an Ajax model which must poll the server at some interval.

Ajax and Comet are similar but not fully interchangeable; I can see uses for each.

Read more about Comet. Also read about Comet from Phil Windley.