Apache2 没有响应
我正在尝试通过 Prototype/php 发出 Comet 请求,如下所示: http://www.zeitoun.net /articles/comet_and_php/start
但是!!!当连接打开时,我的项目中的其他页面无法从同一浏览器加载。 我该怎么做才能提供正常行为?
非常非常tnx
I am trying to make Comet requests via Prototype/php like here : http://www.zeitoun.net/articles/comet_and_php/start
But!!! While connection is open, other pages from my project is not loading from the same browser.
What can I do to provide normal behaviour?
Very very tnx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Comet 的工作原理是保持服务器和客户端之间的连接打开。浏览器有允许页面建立的最大连接数(例如 IE 的最大连接数为 2),我认为它也可能会将同一域的所有请求分组在一起。这就是为什么你无法建立连接的原因。
我相信这不是服务器的问题,而是浏览器的问题,正如您提到的,使用 iframe 是正确的解决方案,但这不是服务器的错误。
[编辑]
对您来说最简单的解决方案是监控焦点。当页面获得焦点时,打开连接,当连接丢失(即用户切换选项卡)时,关闭连接并再次等待焦点,然后再更新页面。这样,您将拥有多个页面更新的外观,而任何时候只需要 1 个彗星连接。
Comet works by keeping a connection open between the server and the client. Browsers have a maximum number of connections that they will allow a page to make (something like 2 max for IE), I think it might also group all requests for the same domain together. That is why connections are not going through for you.
I believe it is not the server that is at fault here it is the browsers, using an iframe is the correct solution here as you mentioned, but it's not the servers fault.
[Edit]
Simplest solution for you is to monitor focus. When the page has focus, open a connection, when it is lost(ie. user switches tabs) close the connection and wait for focus again before updating the page. That way you will have the appearance of multiple pages updating while only needing 1 comet connection at any time.