Home > Asp.Net > Comet and Reverse AJAX

Comet and Reverse AJAX

Today,i found a good example of Reverse AJax-comet with Asp.Net.Comet Example

  • Q. What is Reverse AJAX?
  • Ans.Reverse Ajax refers to an Ajax Design Pattern that uses long-lived HTTP connections to enable low-latency communication between a web server and a browser. Basically it is a way of sending data from client to server and a mechanism for pushing server data back to the browser.

In general Client-Server communication takes one of following two forms.

  1. Client Polling
    • With this method client repetitively sends a request(query) to the server and waits for the response.

2. Server Push

  • With this method connection between client & server kept open & server sends response when available.

For example,we have chat application and 2 clients and 1 server is available.Client-1 wants to send message “Hello Reverse AJAX” to all other clients.

First we consider tradition client polling method.

  • Client-1 sends message “Hello Reverse AJAX” to server.
  • Server receives message “Hello Reverse AJAX”.
  • Client-2 polls the server.
  • Client-2 receives the message “Hello Reverse AJAX”.
  • Client-1 polls the server.
  • Client-1 receives the message “Hello Reverse AJAX”

Imagine if we have more clients say up to 100 then each client needs to poll the server and waits until server response.It will creates a more traffic and puts load on server.At one stage server will too busy and it can’t serve more request.

Client Polling

Now let’s see what happenes if we use Server polling

  • Client-1 sends a message “Hello Reverse AJAX” to server.
  • Server receives the message “Hello Reverse AJAX”.
  • Server sends message “Hello Reverse AJAX” to all clients.

Advantage with server polling is that it creates less traffic. So messages are transferred with less delay(low latency).

Server Polling

Server Polling

There are some good  applications which are based on Comet Reverse AJAX.Many social community websites uses this technology.I found a very good example with PHP  on http://www.cometchat.com/

Hope this helps,

Jignesh


Advertisements
Categories: Asp.Net
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: