Skip to content

Instantly share code, notes, and snippets.

@ollieparsley
Created November 24, 2011 14:34
Show Gist options
  • Save ollieparsley/1391474 to your computer and use it in GitHub Desktop.
Save ollieparsley/1391474 to your computer and use it in GitHub Desktop.
Very simple WebSocket load test script
/**
* Very simple load testing script
*
* It will open WebSocket connections and close them as soon as they are open
*
* Warning: This may crash your browser after a few minutes
* To stop the script just close the tab :p
*/
//Place this into a script
setInterval(function(){
var ws = new WebSocket('ws://<HOST_NAME_HERE>');
ws.onopen = function(){
ws.close();
};
}, 1);
//Or just put this into the address bar of your browser
javascript:setInterval(function(){var ws=new WebSocket('ws://<HOST_NAME_HERE>');ws.onopen=function(){ws.close();};},1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment