Ajax Server Initiated Server Calls

I believe that I now need to rethink the Ajax sequence on the project I am working on for work. As it stands, I had to do some interesting tinkering to make things work and emulate the console side properly. A normal sequence of GETs and POSTs would have been sufficient, except I needed something to handle server pushes. In the console application, there are some instances like popup boxes. Eg. After the client sends a request to the server, the server sends back a simple popup box, sorting. After it is done sorting, the server sends back the information to the browser. And this is the problem. Normally, Ajax does not handle this. This is where I had to implement a modified polling technique.

Basically, the client makes constant requests to the server. Yes, yes, I know that this is very inefficient, but this is a rough draft. Well, rough working draft. The server sends back a NULL flag, which the browser reads and ignores, or it sends back the requested data. This works, but is very inefficient. Normally, server initiated Ajax routines use a polling technique. This involves the client basically pinging the server on regular intervals to request data. I’m doing the same thing but without the time delay.

Everyone seems to be implementing this using some polling technique. Meebo, the now popular Ajax based Web Messenger, uses a polling technique. Anyterm, a terminal emulator, also uses polling.

Polling would work for me, however, it wouldn’t be much different from what I’m already doing. There is an alternative though, HTTP Streaming, which I need to look into. From the little I’ve read, though, it is riddled with complications.