Web Design & Development Guide
Reverse Ajax
Reverse Ajax, not unlike DHTML, LAMP, Ajax and SPA, is not a technology in itself, but a term that refers to the use of a group of technologies together. These technologies include:
- Ajax for handling the data on the client side in a smooth and interactive way, and passing data between server and client.
- A technology for pushing server data to a browser
- Comet, a connection between a server and client is kept open, by slowly loading a page in a hidden frame.
- Piggyback, extra data is added (piggybacked) onto a normal client-server interaction.
- Polling, the client repetitively queries (poll) the server.
Reverse Ajax is different from Ajax, as Reverse Ajax is a suite of technologies for pushing data from a server to a client. These technologies are built upon an Ajax framework.
Notes
The Polling technique is not properly a Reverse Ajax solution, because in this case the server simply responds to a repeated direct ajax request. The result is the same that Reverse Ajax, but this technique is not too elegant to be used because it makes a lot of unnecessary traffic.
Let's take a simple example:
The broadcast message.
We have 2 clients and 1 server: client1 needs to send "hello" to all the other clients
With Polling:
- client1 sends the message "hello"
- server receives the message "hello"
- client2 polls the server
- client2 receives the message "hello"
- client1 polls the server <-- unnecessary traffic starts
- client1 receives the message "hello"
- client2 polls the server
- client2 receives the message "hello" <-- unnecessary traffic continues
and these last lines repeat forever.
With Comet:
- client1 sends the message "hello"
- server receives the message "hello"
- server sends the message "hello" to all clients
no unnecessary traffic.
With PiggyBack:
- client1 sends the message "hello"
- server receives the message "hello"
- client2 does any request to the server
- server adds to the response the message "hello"
no unnecessary traffic.
See also
External links
- Articles
- Reverse Ajax
- Exploring Reverse Ajax
- Beyond Ajax
- Changing the Web Paradigm
- Comet Low Latency Data for the Browser
- Implementations
- DWR Project homepage
- Full-duplex Ajax A module for Lighttpd web server
- RJAX A Java Open Source solution using an applet and a server embedded in the web application