如何为Gmail聊天能够使无客户端交互AJAX请求? [英] How is GMail Chat able to make AJAX requests without client interaction?

查看:146
本文介绍了如何为Gmail聊天能够使无客户端交互AJAX请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有的HTTP响应需要客户端启动它们,即使那些使用AJAX进行。但Gmail的聊天功能能够从其他用户接收消息,即使我只是坐在我的舒服计算机椅子上看而不是与浏览器交互。他们是如何做到的呢?

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等。

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

这是关于从服务器推数据到浏览器,保持HTTP连接活着。找到它放在维基百科文章的详细信息(的英文版)。

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).

另外这里是一个 pretty的良好presentation 乔沃克从DWR,在那里,他谈到了彗星。

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

这篇关于如何为Gmail聊天能够使无客户端交互AJAX请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆