Facebook 实时聊天背后的概念(数据传输)是什么?
我最近加入了 Facebook(我知道我迟到了),昨晚我带着一个奇迹醒来。看起来像实时聊天模块 大约每秒“寻找”新的应答消息。在我看来,这有点太快了。我不知道他们是如何设法不得到他们的 服务器还活着。
我想知道背后的概念是什么。或者至少,你们认为他们是如何实现这一目标的。
我还没有运行 Firebug 来查看发送的 XHR
请求。
我相信,如果实时聊天保存在 Iframe 中,并且 XHR 发送到不同的 HTTP 服务器,那么它将保留“主” 服务器“冷却器”。此外,使用 Iframe 方法将避免由于“main”使用的 cookie 而发送过多的带宽。 网站。
我不想要这样的答案“他们有数百台服务器每分钟接收数百万个请求,他们可以生存。”。 我确信我只是想念他们的一些巫毒魔法。 :P
无论如何,有人有什么想法吗?
I recently joined Facebook (I know I'm late) and I woke up last night with a wonder. It looks like the live-chat module
"looks" for new answer message every second or so. Which is a bit too fast IMO. I have no idea how they manage to not get their
servers alive.
I would like to know what is the concept behind. Or atleast, how do you guys thinks they achieve that.
I've not yet run Firebug to see the XHR
requests beings send.
I believe if the live-chat is hold into an Iframe and the XHRs send to a different HTTP server it would be keep the "main"
server "cooler". Also, using the Iframe method will avoid to send too much bandwidth due to the cookies used by the "main"
website.
I dont want an answer like "They have hundreds of servers receiving millions requests a minute, they can survive.".
I'm sure I'm just missing some of their voodoos magics. :P
Anyway, any ideas anyone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
信息可在此处获取:
http://www.facebook.com/note.php?note_id=14218138919
这些幻灯片几乎解释了一切:
http://www.slideshare.net/dariosalvelli/eugene-letuchy-erlangat-facebook
Information is available here :
http://www.facebook.com/note.php?note_id=14218138919
And these slides explain pretty much everything :
http://www.slideshare.net/dariosalvelli/eugene-letuchy-erlangat-facebook
也许他们正在使用 websockets 或类似的东西来保持与服务器的持久连接,而不是每次需要发送数据时打开/关闭 HTTP 连接。
Maybe they are using websockets or something of the sort, you know, to keep a persistent connection with the server instead of opening/closing an HTTP connection every time data needs to be sent.
您可能需要在 Google 上搜索 xmpp
You might want to google search for xmpp
上次我用 firebug 看它时,确实是几个月前,看起来他们正在使用彗星方法。 XHR 打开长达一分钟,它要么返回新数据,要么在一分钟结束时什么也没有返回。
The last time I looked at it with firebug, which admittedly was many months ago, it seemed like they were using the comet method. There was an XHR open for up to a minute, which would either return with new data, or at the end of a minute, nothing.