Reverse Ajax

From Wikipedia, the free encyclopedia

Reverse Ajax refers to the combined use of Ajax for sending data from client to server, and some mechanism for pushing server data back to the browser.[1]

This server–client communication takes one of several forms:

  • Comet, a connection between a server and client is kept open, by slowly loading a page in a hidden frame.
  • Polling, the client repetitively queries (poll) the server.

Reverse Ajax is an umbrella term which describes the implementation of any of these models.

[edit] Examples

As a simple example, imagine we have 2 clients and 1 server, and client1 needs to send the message "hello" to every other client.

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

Note that in the Comet less traffic is generated.

[edit] See also

[edit] External links


Implementations