1.0.8 • Published 2 years ago

mqtt-client-cli v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

mqtt-client-cli

A simple MQTT Client CLI.

This library is created and maintained by Anas Aneeque

This library is written for Node.js

Written in typescript.

Features

  • Connect to MQTT Server using broker url.
  • Test MQTT Connections.
  • Subscribe topic and receive messages.
  • Publish message to topic.

Usage

Use it with CLI.

npm i -g mqtt-client-cli
mqtt-client-cli <BROKER URL>

or also you can use shorthand

mcc <BROKER URL>

Broker URL Example

protocol://user:password@host:8883/path

Usage Example

Subscribe to a topic

sub Hello

Subscribe Example

Now to check whether we are really subscribed, we will publish a message to Hello

pub Hello "Hello World"

Publish Example

Voila we received a message, output format of the recieved message is '@'

Any error occur in subscribing or publishing, a log will be received

Error Example

At last, exit anytime by pressing e.

Use as a package in other nodejs app.

Install it in your project.

npm install mqtt-client-cli

Use in your project with same interface as of cli.

const { connectMQTT } = require("mqtt-client-cli");
connectMQTT("ws://localhost:1883");

Support

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago