What is reverse ajax?
Inverting AJAX is essentially a concept: data that can be sent from the server to the client. In a standard HTTP Ajax request, data is sent to the server so that the server can send events to the client (low latency communication).
Comet
Schematic:
Comet using HTTP streaming
Code Demo
Client:
Server:
Comet using HTTP long polling
Long polling mode involves techniques that open a connection. The connection is kept open by the server, and, as long as the event occurs, the response promises and closes the connection. Then, a new long-polling connection is reopened immediately, waiting for new events to arrive at the client.
Code Demo
Client:
Server:
In general, Comet with Ajax long-pollin is a good compromise to satisfy:
low latency communication timeouts and error detection;
simplicity;
good support for all browsers and platforms; support for
common containers.