Comet is the new Ajax

Jan 9, 2008

Ajax used to be an obscure, misunderstood and often ignored technology. Then websites like Google Maps and Mail appeared with their unique interactive features that were unlike anything else on the web. Ajax soon became the buzzword darling of every web lackey and their managers. Now it's powering the "web 2.0" phenomenon.

Comet is the new Ajax. If you've never heard of it, I doubt you're alone. It's off most mainstream radars right now, but heating up amongst web 2.0 types. This means it's the perfect time to start paying attention to it.

Here's the problem with Ajax: interactivity is clumsy. Consider an Ajax program to monitor stock prices. Most programmers would create an interface that polls ("refreshes") a server at some interval, say 30 seconds, downloading the updated stock prices whether they've changed or not. This is not ideal, but it works for stock prices. What about a multiplayer game or chat program? 30 seconds is a long time to wait between messages or laser blasts.

Comet allows you to write this application in reverse. Instead of mindlessly polling the server for data, your application just waits. It opens an asynchronous connection and sits there until the server sends data to it. All the while going about processing mouse-clicks or other events, just like you'd expect.

This is of major benefit to user interactivity and web-application design. No longer dependent on server polling or waiting for events to update data, applications can become truly interactive and real-time.

Sounds great, but don't get too excited. Current Comet implementations are rather complicated and relatively immature. Production setups will need a special web server, like Jetty, that can scale a large number of open-ended connections. And the design of your application, both server and client-side, requires new considerations to take advantage of the asynchronous environment.

I've recently subscribed to the Comet Daily, which began in October and is a great resource. There seems a relative dearth of additional blogs on the subject, but there are numerous open-source and commercial projects underway. These are best documented on the Wikipedia page.

Another piece of required reading is Alex Russell's introductory blog post. This is what coined the term 'Comet'. It's important to remember this technology existed well before it was given a name. Just like Ajax, it's a set of techniques used to bring interactivity to the browser. But by giving them a name, the theory goes, it will generate buzz and increase adoption.

Comments

No one has posted any comments yet. How about it, tiger?

OpenID Login

To leave a comment, sign-in with your OpenID.