网页中服务器和客户端之间的实时连接
如何在 FriendFeed、Stackoverflow、Blip.fm 等应用程序中实现实时更新 /live html 流方法?
是否每 X 秒使用一次从客户端到服务器的 jQuery/Ajax 请求来完成? (FriendFeed 就像每 1 秒)或者还有其他技术?
How do I implement a real time updating /live html streaming method in applications like FriendFeed, Stackoverflow, Blip.fm ?
Is it done using a jQuery/Ajax request from client to server every X seconds? (FriendFeed is like every 1 second) or there is another technique?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有很多技术和想法开始出现,以满足更具交互性的网络的需求。您可以在 stackoverflow 上找到一些参考,
您可以研究Comet、轮询和 javascript 等。SO
的作用是通过使用 ajax POST 请求来检查活动 https://stackoverflow.com/posts/2977129/answer-例如在此问题页面中的活动心跳。该请求返回是否发生了某些活动,并采取相应的操作。
There are a lot of techniques and ideas that started to came up with the need of a more interactive web.. You can find some reference here at stackoverflow
You can research about Comet, Polling and javascript, etc.
What SO does is to check the activity by using an ajax POST request to https://stackoverflow.com/posts/2977129/answer-activity-heartbeat for example in this question page. The request returns whether there was some activity happened or not, and an action is taken accordingly.
是的,最常见的方法是将 ajax 与客户端和服务器框架(例如 jQuery 和 ASP.NET、jQuery 和 PHP、Prototype 和 X 等)一起使用。
由于 Web 是“无状态”的,因此您必须拥有某种客户端“轮询”机制将定期与服务器对话并更新 UI。
Yes the most common method is to use ajax with a client and server framework (such as jQuery and ASP.NET, jQuery and PHP, Prototype and X, etc.)
Since the web is 'stateless' you have to have some sort of clientside 'polling' mechanism that will periodically talk to the server and update the UI.