Comet, The Next Step Beyond Ajax

Gmail was released on April 1st, 2004. It wasn’t until February 18th, 2005 that Jesse James Garrett of Adaptive Path coined the term Ajax. The same thing is happening all over. Except this time, it’s not Jesse James Garrett; it’s Alex Russell. And it’s not Ajax. It’s Comet.

The Irish Developer Network has Alex Russell’s article about a technique called Comet, “the next step of Ajax.” Ajax is a technique that provides a way for the client to request information from the server without refreshing an entire webpage. Comet is a technique that provides a way for the server to continually send data to the client, even when the client isn’t requesting data. Because sometimes, the server has a lot of information to communicate to the client, and it doesn’t need the client to request anything. Here’s Alex Russell’s augmentation of Jesse James Garrett’s picture describing these technologies:

ajax-fig2

It took ten months after the release of Gmail for Ajax to become a common technology. It took ten months for others to discover what Google was doing and to learn how to implement it themselves. It took ten months to come to the point where the programmer’s brain said, “This web app communicates with the server without refreshing the page. I like that!”

The same thing is happening all over again. Except in a short while, the programmer’s brain will become trained to say, “This web app has a large amount of data that it wants to send to me. The server is continuously sending data to my browser, so it’s there immediately when I ask for it. I like that!”

Several web apps use this Comet technique today:

Let’s take Google Maps for example. If Google Maps used Ajax and did not use Comet, it would behave in such a way that when a user navigates the map westward, the XmlHttpRequest object would fetch the new images from the server without a page refresh. Using only Ajax, you would need to wait for those images to be downloaded to your browser. Sure you wouldn’t have to wait for the whole page to refresh, but you would still see a “loading” image every time. Take one look at Google Maps and you can see that this is not the case! How are those images displayed in the browser seemingly instantly? It appears as if the new areas of the map have been waiting for you to scroll to them! The only way this is possible is if the server had already sent the data to the client. With Comet technology, the server can continuously send data to the client. You might describe it by saying that the client pre-fetches data from the server, but it’s more accurate to say the server is pre-pushing data to the client. And as Alex Russell points out, “the data is delivered over a single, previously-opened connection. This approach reduces the latency for data delivery significantly.”

In Gmail Chat and Meebo, you don’t need to click a check-for-new-messages button to see if anyone sent you an instant message. The server is continuously pushing data to your browser.

In Jot Live, you don’t need to click a refresh button to see if anyone posted any changes to the shared text document you’re viewing. The server is continuously pushing data to your browser.

Google Engineers, you people are so far ahead of the rest, it’s sometimes scary. I can’t wait to see Google Calendar, and beyond.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: