简体   繁体   中英

Can't open more than one connection to the same SockJS endpoint

I'm developing an application that uses SockJS to update some common data across the other applications connected to the server. The problem comes when I try to open it in two browser tabs because just one of them achieve the connection while the other keeps waiting until the timeout comes.

¿Can anyone explain me why is this happening? ¿Is there any solution?

On the server I'm using an Spring implementation of SockJS whit the WebSocket transport disabled because the application server doesn´t support it.

To anyone who find this helpful, I ended up discovering that the HTTP/1.1 protocol recommends a connection limit of two connections per domain, so, the browsers share this two connections across any tab/window/iframe. As a result, when this two connections are consummed, every other connection/request have to wait until one of that two connections is released.

Libraries like cometd handle this by detecting when multiple clients are connected and falling back to normal poll.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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