In my app, I need to scan through 10 webSocket addresses to see which one is available regularly. Here is how I use the client:
var wsConn = $websocket('ws://mySite.com', null, {maxTimeout: WS_CONNECT_TIMEOUT});
wsConn.onError(function(event) {
// try another address});
wsConn.onOpen(function() {
// do something for success });
wsConn.onMessage(function(msg) {
// do something for receiving message
});
The first couple rounds of scan works alright. Either onError or onOpen will be triggered in 20ms. But after that, it become really slow. onError or onOpen are usually triggered after 2000ms. Even refresh the page doesn't help. If i open a new tab or restart browser, it works fine and becomes slow after couple rounds of scan.
In my app, I need to scan through 10 webSocket addresses to see which one is available regularly. Here is how I use the client:
The first couple rounds of scan works alright. Either onError or onOpen will be triggered in 20ms. But after that, it become really slow. onError or onOpen are usually triggered after 2000ms. Even refresh the page doesn't help. If i open a new tab or restart browser, it works fine and becomes slow after couple rounds of scan.
I use Chrome.
Any idea? Thanks!