支持多窗口的 Comet JavaScript 库
是否有任何免费的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您在开源世界中找到的最接近的东西将是 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.
您不能直接执行此操作,因为不同的浏览器窗口/选项卡不知道其他浏览器/选项卡中打开了哪些连接。 您能做的最好的事情是: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.