Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
websocket-bench
Advanced tools
Readme
Nodejs cli tool for benchmarking websocket servers. Currently supports:
npm install -g websocket-bench
First Install required dev-dependencies npm install
Run Gulp Build Tool gulp mocha
Tip: You may find it useful to increase the maximum number of open file descriptors on your system during testing:
ulimit -n 60000
Simple example (using Socket.IO by default):
websocket-bench -a 2500 -c 200 http://localhost:3000
Simple example (using Primus):
websocket-bench -t primus ws://localhost:8080
command help
Usage: websocket-bench [options] <server>
Options:
-h, --help Output usage information
-V, --version Output the version number
-a, --amount <n> Total number of persistent connection, Default to 100
-c, --concurency <n> Concurent connection per second, Default to 20
-w, --worker <n> Number of worker(s)
-g, --generator <file> Js file for generate message or special event
-m, --message <n> Number of message for a client. Default to 0
-o, --output <output> Output file
-t, --type <type> Type of websocket server to bench(socket.io, engine.io, faye, primus, wamp). Default to socket.io
-p, --transport <type> Type of transport to websocket(engine.io, websockets, browserchannel, sockjs, socket.io). Default to websockets (Just for Primus)
-k, --keep-alive Keep alive connection
-v, --verbose Verbose Logging
For benchmark message or more advanced connection you should provide your own generator
generator structure :
module.exports = {
/**
* Before connection (optional, just for faye)
* @param {client} client connection
*/
beforeConnect : function(client) {
// Example:
// client.setHeader('Authorization', 'OAuth abcd-1234');
// client.disable('websocket');
},
/**
* On client connection (required)
* @param {client} client connection
* @param {done} callback function(err) {}
*/
onConnect : function(client, done) {
// Faye client
// client.subscribe('/channel', function(message) { });
// Socket.io client
// client.emit('test', { hello: 'world' });
// Primus client
// client.write('Sailing the seas of cheese');
// WAMP session
// client.subscribe('com.myapp.hello').then(function(args) { });
done();
},
/**
* Send a message (required)
* @param {client} client connection
* @param {done} callback function(err) {}
*/
sendMessage : function(client, done) {
// Example:
// client.emit('test', { hello: 'world' });
// client.publish('/test', { hello: 'world' });
// client.call('com.myapp.add2', [2, 3]).then(function (res) { });
done();
},
/**
* WAMP connection options
*/
options : {
// realm: 'chat'
}
};
French article about websocket-bench : Benchmarking websockets avec Node.Js
FAQs
tool for benchmark websocket (socket.io, faye)
The npm package websocket-bench receives a total of 17 weekly downloads. As such, websocket-bench popularity was classified as not popular.
We found that websocket-bench demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.