Ajax chat polling bandwidth efficiency Ajax chat polling bandwidth efficiency ajax ajax

Ajax chat polling bandwidth efficiency


Polling might not be the best solution for implementing a chat - I'd suggest taking a look at JQuery's implementation of COMET which keeps an open connection to the client and pushes updates from the server 'down' and is also quite scalable.


I think for a chat application you can use

Reverse Ajax

Reverse Ajax refers to an Ajax design pattern that uses long-lived HTTP connections to enable low-latency communication between a web server and a browser. Basically it is a way of sending data from client to server and a mechanism for pushing server data back to the browser.1

This server–client communication takes one of two forms:

* Client polling, the client repetitively queries (polls) the

server and waits for an answer. * Server pushing, a connection between a server and client is kept open, the server sends data when available.

Reverse Ajax describes the implementation of either of these models, or a combination of both. The design pattern is also known as Ajax Push, Full Duplex Ajax and Streaming Ajax.

and

moo-comet

Request.Comet is a simple javascript class to create cross browser Comet(Reverse Ajax) applications easily. It provides realtime data transfers between client and server and can be used with any server-sided language.


I've written almost EXACTLY the same application to facilitate communication between friends at work when various employers use draconian web filtering.

I found that the the amount of data transfered for these polling requests is minimal and rarely approaches 1kb/s per logged on user, usually way less since you're only polling ever 5s.

Is bandwidth really an issue or are you prematurely optimizing?