Comet是如何实现的?

发布于 2024-08-18 02:44:33 字数 406 浏览 1 评论 0原文

我想知道如果请求的连接还没有完成,客户端如何得到响应?

原理是什么?

事实上,我已经阅读了很多关于这个主题的帖子:

How do I Implement basic“Long Polling” "?

直播怎么样,Google Wave 中的实时输入工作?

但都没有解决我的疑问

I wander how do client side get response if the connection of request is not finished yet?

What's the principle?

In fact I've read quite a few posts on this subject:

How do I implement basic "Long Polling"?

How does the live, real-time typing work in Google Wave?

But none of them solve my doubt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

笑看君怀她人 2024-08-25 02:44:33

答案取决于所使用的技术。

使用“隐藏 Iframe”技术的 HTTP 流可以做到这一点。该技术是服务器将

The answer depends on the technique used.

HTTP streaming, using the "hidden Iframe" technique, can do this. The technique is that the server sends <script> elements to the hidden iframe. Each script element will contain some executable JavaScript. This technique relies on the fact that browsers generally interpret an HTML element as soon as it is loaded. In this way, there is no need for any sort of polling code in the client; the script tags will contain the appropriate function calls, and the browser will execute those calls as soon as the script element is completely loaded.

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