支持多窗口的 Comet JavaScript 库

发布于 2024-07-30 19:39:31 字数 358 浏览 2 评论 0原文

是否有任何免费的 Comet JavaScript 库允许多个窗口/选项卡重复使用相同的库联系? 换句话说,当您打开第二个窗口时,它会检测到您在同一域下打开了另一个窗口。 它不是打开一个新连接,而是开始侦听另一个窗口的连接。 这样它就可以保持在浏览器的每个域连接限制之内。

Lightstreamer 似乎可以很好地处理这个问题,但我更喜欢开源的东西。

Are there any free Comet JavaScript libraries that allow multiple windows/tabs to reuse the same connection? In other words, when you open a second window, it detects that you have another window open under the same domain. Rather than open a new connection, it starts listening to the other window's connection. That way it can stay within the browser's per-domain connection limit.

Lightstreamer seems to handle this well, but I'd prefer something open-source.

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

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

发布评论

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

评论(2

煮茶煮酒煮时光 2024-08-06 19:39:31

我认为您在开源世界中找到的最接近的东西将是 Dojo。

我确信将来,您会看到更多对此类功能的开源支持......但现在您可能必须一起破解一些东西。

I think the closest thing you're going to find in the Open Source world is going to be the functionality build into Dojo.

I'm sure in the future, you'll see more Open Source support for that kind of functionality...but for now you might have to hack something together.

请止步禁区 2024-08-06 19:39:31

您不能直接执行此操作,因为不同的浏览器窗口/选项卡不知道其他浏览器/选项卡中打开了哪些连接。 您能做的最好的事情是:1)通配符一堆子域(每个域的限制也是每个子域)或2)使用cookie或其他形式的持久存储并回退到短轮询,这就是dojo 框架可以。

You can't do that directly, because different browser windows/tabs don't know what connections are open in other browsers/tabs. The best you can do is either 1) wildcard a bunch of subdomains (the per-domain limit is per-subdomain too) or 2) use a cookie or some other form of persistent storage and fall back to short-polling, which is what the dojo framework does.

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