Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anasnew99/mqtt-cli
Simple MQTT CLI Created in NodeJS
https://github.com/anasnew99/mqtt-cli
cli mqtt mqtt-cli mqtt-client pubsub
Last synced: 1 day ago
JSON representation
Simple MQTT CLI Created in NodeJS
- Host: GitHub
- URL: https://github.com/anasnew99/mqtt-cli
- Owner: Anasnew99
- License: mit
- Created: 2021-12-04T18:14:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-05T08:47:45.000Z (about 3 years ago)
- Last Synced: 2025-02-12T11:43:06.307Z (3 days ago)
- Topics: cli, mqtt, mqtt-cli, mqtt-client, pubsub
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/mqtt-client-cli
- Size: 194 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [mqtt-client-cli](https://github.com/Anasnew99/mqtt-cli)
> A simple MQTT Client CLI.
> This library is created and maintained by [Anas Aneeque](https://www.linkedin.com/in/anasnew99/)
> 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
```or also you can use shorthand
```
mcc
```Broker URL Example
```
protocol://user:password@host:8883/path
```![Usage Example](https://raw.githubusercontent.com/Anasnew99/mqtt-cli/main/example/connect.jpg)
Subscribe to a topic
```
sub Hello
```![Subscribe Example](https://raw.githubusercontent.com/Anasnew99/mqtt-cli/main/example/sub.jpg)
Now to check whether we are really subscribed, we will publish a message to Hello
```
pub Hello "Hello World"
```![Publish Example](https://raw.githubusercontent.com/Anasnew99/mqtt-cli/main/example/pub.jpg)
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](https://raw.githubusercontent.com/Anasnew99/mqtt-cli/main/example/error.jpg)
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.
```js
const { connectMQTT } = require("mqtt-client-cli");
connectMQTT("ws://localhost:1883");
```# Support