PDA

View Full Version : What's the best server-client communcation approach for a transfer-intensive AJAX app


brothercake
05-23-2006, 09:51 PM
I can't give too much detail for NDA reasons, but here's a broad conceptual overview:

An AJAX app involves frequent communication between multiple clients - imagine an IM client - but of course you can't "push" data to the client, per se, because HTTP is stateless.

So which of these is the better approach:

1 - make frequent, small requests from each client to the server (each client runs a timer that asks for status info every view seconds)

2 - make less frequent requests from each client, which the server holds open, and responds only when a change has occured

The second allows for very fast response latency between clients, but I'm worried it will kill a server by using up all its sockets really quickly (not to mention its memory and CPU time..)

The first doesn't have this problem, but I'm worried the excessive number of requests will kill bandwidth and reduce client latency (because of the need to keep the request frequency to a minimum)


Thoughts? Experiences?