Facebook是否使用彗星或ajax进行通知? [英] Does facebook use comet or ajax for its notifications?
问题描述
facebook会通过彗星推送或每秒检查一次新通知的ajax脚本来获取通知吗?哪种系统更有效?
Would facebook get notifications via comet push or an ajax script that checks for new notifications every second? and which is more efficient for such a system?
推荐答案
在我看来,它更像是彗星,它向?。??。channel.facebook.com发送了GET请求,需要55秒才能超时。此GET请求会在我加载页面的整个过程中重复执行-这是长时间轮询有效。我使用的是Chrome,它可能会为其他浏览器使用其他传输方式。
It looks more like comet to me, there is a GET request to ?.??.channel.facebook.com that takes 55 seconds to time out. This GET request repeats the entire time I have the page loaded - This is how long polling works. I'm using Chrome, it could use a different transport for another browser.
如果有通知,则请求将在55秒超时之前完成。请说30秒,然后会再次发出GET请求。当然,这比每秒轮询更有效。
If there were to be a notification, the request would complete before the 55 seconds timeout. Say at 30 seconds, and another GET request would be made. This is certainly more efficient than polling every second.
这篇关于Facebook是否使用彗星或ajax进行通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!