Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mqtt_tool

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqtt_tool

A simple CLI tool for interacting with MQTT, pub, sub, clear, backup, restore.

  • 0.2.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
0
Weekly downloads
 
Created
Source

MQTT Tool

A simple CLI tool for interacting with MQTT, pub, sub, clear, backup, restore.

Install

npm install mqtt_tool

or globally by adding the -g flag (and possibly sudo)

Usage

If the tool is globally installed, then you can run mqtt_tool directly and from anywhere in your file-tree. Otherwise you need to use npx locally:

> npx mqtt_tool --help
connected to mqtt broker
index.js <command>

Commands:
  index.js sub [topic]        subscribe to a (set of) topic(s) and print to
                              console
  index.js clear topic        clear any retained messages on topic
  index.js pub topic message  publish message on topic
  index.js backup [topic]     create a backup of the given topic
  index.js restore [file]     Restore from a backup file or stdin if omitted

Options:
      --help     Show help                                             [boolean]
      --version  Show version number                                   [boolean]
  -v, --verbose  Run with verbose logging                              [boolean]
  -b, --batch    Stop after a short period. Useful for batching.       [boolean]

Set your ENV variable MQTT_URL to the url of your mqtt broker. The default is mqtts://localhost. When using SSL, i.e., mqtts://, you need to have certificates in a sub-folder called certs/.

Generating local dev certificates

When you run an MQTT broker with self-signed certificates, as is typical in development, you can generate client certificates for this tool like this:

openssl genrsa -out client.key 2048
openssl req -out client.csr -key client.key -new -subj="/CN=myName"
openssl x509 -req -in client.csr -CA PATH_TO/ca.crt -CAkey PATH_TO/ca.key -CAcreateserial -out client.crt -days 36500

echo "certificates generated for:"
openssl x509 -in client.crt -text | grep CN

Keywords

FAQs

Package last updated on 25 Oct 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc