Skip to content

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

Notifications You must be signed in to change notification settings

Joge97/mqtt-stress

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published