网页中服务器和客户端之间的实时连接

发布于 2024-09-04 03:17:59 字数 150 浏览 3 评论 0原文

如何在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

快乐很简单 2024-09-11 03:17:59

有很多技术和想法开始出现,以满足更具交互性的网络的需求。您可以在 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.

乞讨 2024-09-11 03:17:59

是的,最常见的方法是将 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文