简体   繁体   English

Websocket是否会被未决的HTTP请求阻塞?

[英]Could a websocket become blocked by pending http requests?

Other posts and this site make it clear that there is a limit to the number of connections a browser might have pending: 其他帖子和此站点清楚表明,浏览器可能有待处理的连接数受到限制:

http://www.browserscope.org/?category=network http://www.browserscope.org/?category=network

How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers? 流行的浏览器中允许多少个并发AJAX(XmlHttpRequest)请求?

My question is, how might this effect websockets? 我的问题是,这将如何影响网络套接字? Could 6 pending http requests block a msg from the server? 6个未决的HTTP请求能否阻止来自服务器的味精? If so, is there a port configuration that might avoid this? 如果是这样,是否有端口配置可以避免这种情况?

Please forgive my ignorance of all this networking. 请原谅我对所有这些网络的无知。 I am very JS focused and our websocket usage is critical. 我非常注重JS,因此我们的websocket使用至关重要。

Thank you, Rc 谢谢,RC

It could block, but there may be numerous other reasons. 它可能会阻止,但是可能还有许多其他原因。

Try reducing amount of requests. 尝试减少请求量。 If you still have a problem, then the reason of blocking is elsewhere. 如果仍然有问题,则阻塞的原因在其他地方。

Once I faced a problem in php/Symfony2, when pending request was blocking any other connections due to session lock. 一旦我在php / Symfony2中遇到问题,待处理的请求由于会话锁定而阻止了其他任何连接。

Nope. 不。

A WebSocket is a persistent connection, it stays connected all the time as long you do not navigate away. WebSocket是一个持久的连接,只要您不离开就可以一直保持连接状态。

Each browser implement its own connection limit, that may delay or block temporally the WebSocket connection if there are too many ongoing connections, but once the connection is established, no messages will be block because of that. 每个浏览器都实现自己的连接限制,如果正在进行的连接太多,则可能会延迟或暂时阻止WebSocket连接,但是一旦建立连接,就不会因此而阻止任何消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM