I want to do a stress test against my websocket server, run this javascript example in my browser (chrome) below:
function create_ws() { var ws=new WebSocket("ws://127.0.0.1/"); ws.onopen=function(evt){ var binary = new Uint8Array(2); binary[0]=1; binary[1]=2; ws.send(binary.buffer); }; ws.onclose=function(evt){}; ws.onmessage=function(evt){}; ws.onerror=function(evt){}; } var connections = []; var numberOfconnections=100; for(var i = 0; i < numberOfconnections; i++) { connections.push(create_ws()); }
The problem is this: the script allows me to run only about 100 connections. If I increase numberOfconnections to 300, this causes the following error: WebSocket connection to 'ws://127.0.0.1/' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES
Is there a way to increase the number of browser connections in the browser?
source share