How is GMail Chat able to make AJAX requests without client interaction?

AjaxGmailCometChat

Ajax Problem Overview


All HTTP responses require the client to initiate them, even those made using AJAX. But GMail's chat feature is able to receive messages from other users, even when I'm just sitting in my comfy computer chair watching but not interacting with the browser. How did they do it?

Ajax Solutions


Solution 1 - Ajax

That tech is known as "comet", but also as "server push", "reverse ajax", etc.

It's about pushing data from the server to the browser, keeping an http connection alive. Find more info on it on the wikipedia article (English version).

Also here's a pretty good presentation with Joe Walker from DWR, where he talks about comet.

Solution 2 - Ajax

As you rightfully pointed out, HTTP requires data to be 'pulled' by the client. Gmail can still 'pull' data from the server by using a timer to trigger the HTTP operation instead of requiring the user to click something. So, it may seem to be auto, but it is still client initiated.

Solution 3 - Ajax

Yep Comets is correct. Google Web Toolkit Applications by Ryan Dewsbury explains how to create a Comets based Instant Messenger application in chapter 9.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionchatView Question on Stackoverflow
Solution 1 - AjaxPablo FernandezView Answer on Stackoverflow
Solution 2 - AjaxsybreonView Answer on Stackoverflow
Solution 3 - AjaxAnkurView Answer on Stackoverflow