PHP Classes


Recommend this page to a friend!

      PHP Classes blog  >  Responsive AJAX appli...  >  All threads  >  Comet  >  (Un) Subscribe thread alerts  
Summary:Difference between Ajax And Comet
Author:Satish Kumar
Date:2007-11-21 07:16:37
Update:2007-11-21 16:36:46

  1. Comet   Reply   Report abuse  
Picture of Satish Kumar Satish Kumar - 2007-11-21 07:33:47

Can i know the difference between Ajax and html

  2. Re: Comet   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-11-21 07:35:03 - In reply to message 1 from Satish Kumar
AJAX and HTML? What do you mean? AJAX and HTML are not comparable things.

  3. Re: Comet   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-11-21 16:36:46 - In reply to message 1 from Satish Kumar
I just noticed from the subject that you meant the difference between AJAX and COMET, rather than HTML.

AJAX and COMET are for the same purpose, allow the browser to communicate with the server without page reloading.

The difference is that with a single COMET request you can get multiple asynchronous responses from the server. With AJAX you need to perform multiple requests to get responses to multiple actions.

With COMET you can not only request the server to execute an action, but also return the progress of execution of the action until it is done.

Lets say you want to execute a long task made of small tasks. With COMET you can tell the user what exactly what task is being executed on server within a single request, therefore within a single transaction.

With AJAX, either you perform multiple requests to poll the status of an action to let the user know what is going on, or you wait until the whole task is done without giving user feedback.

You can also use a single COMET request to execute actions get feedback that you don't know when they will happen.

You can use this to implement a chat service that shows what each user said when it happens.

To do the same with AJAX, you need to keep polling the server asking if anybody said anything. Not only is a much slower approach, but it also takes more bandwidth.