22 Mar 2008 1434H

AJAX polling techniques

To sum it up, AJAX is dependent on a kind of client-side data request method called polling. The browser opens a connection and constantly asks the server at a fixed interval, “do you have updates for this data?” To which the server is forced to reply, “yes, here it is” or “no” and closes the connection.

There are other types of request handling techniques using an architecture called Comet, which drives data down to the client from server events. The browser need only ask once, and the server will do the rest. That’s the theory anyway.

One is a revival of the old 90s push technique, but using AJAX, called streaming, so that now when the browser — or 10,000 browsers — open a single persistent connection and asks, “Do you have updates?” the server can just park the request until there are updates and then push that data to the browser, but instead of closing the connection, they keep the connection open and reuse it.

Then there is the long-polling technique, which if your server supports asynchronous request processing (as Tomcat does) optimizes the original polling technique, in which a browser request is kept open until the server has an update to provide or until it times out, then pushes it to the browser and closes the connection. The browser immediately opens the connection again, and the cycle starts again.

Permanent link to AJAX polling techniques

Filed under Technology


Be the first to respond to "AJAX polling techniques"

RSS feed for comments on this post. TrackBack URL

No responses yet.


And now it's your turn.

Fire your weapon, soldier. Just be careful of friendly fire. NAME & EMAIL required.

Your response