1.0.2 • Published 5 years ago

mqtt-stress v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

mqtt-stress

CLI Tool for sending a lot of messages over mqtt for stress testing services

Install

Install with npm

CLI:

$ npm i -g mqtt-stress

API:

$ npm i mqtt-stress

Usage

CLI:

$ mqtt-stress -b mqtt://localhost -t topic "message"

For more information run mqtt-stress --help

API:

var mqttStress = require('mqtt-stress');


var result = mqttStress.stress('mqtt://localhost', 'topic', 'message');

result.events.on('throughput', throughput => {
    console.info(`Throughput: ${throughput}`);
});

result.events.on('error', err => {
    console.error(`Error: ${err}`);
})

setTimeout(() => {
    result.stop()
        .then(() => {
            console.info('Stopped successfully!');
        })
        .catch(err => {
            console.error(`Error while stopping: ${err}`);
        })
}, 1000);

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Joge

License

Copyright © 2019 Joge Licensed under the MIT license.