1.8.3 • Published 2 years ago

asuka-cli v1.8.3

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
2 years ago

MQTT X CLI

GitHub Release build packages Total Downloads Docker Slack Discord Community YouTube Twitter

English | 简体中文


MQTT X CLI is an open source MQTT 5.0 CLI Client and MQTT X on the command line. Designed to help develop and debug MQTT services and applications faster without the need to use a graphical interface.

MQTT stands for MQ Telemetry Transport. It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks.

Preview

mqttx-preview

Installation

macOS

To install the latest MQTTX CLI stable release on macOS using binary download.

Note: Please note CPU architecture of the current system environment

Intel Chip

curl -LO https://www.emqx.com/en/downloads/MQTTX/v1.8.2/mqttx-cli-macos-x64
sudo install ./mqttx-cli-macos-x64 /usr/local/bin/mqttx

Apple Silicon

curl -LO https://www.emqx.com/en/downloads/MQTTX/v1.8.2/mqttx-cli-macos-arm64
sudo install ./mqttx-cli-macos-arm64 /usr/local/bin/mqttx

Homebrew

brew install emqx/mqttx/mqttx-cli

Linux

To install the latest MQTTX CLI stable release on Linux using binary download.

Note: Please note CPU architecture of the current system environment

x86-64

curl -LO https://www.emqx.com/en/downloads/MQTTX/v1.8.2/mqttx-cli-linux-x64
sudo install ./mqttx-cli-linux-x64 /usr/local/bin/mqttx

ARM64

curl -LO https://www.emqx.com/en/downloads/MQTTX/v1.8.2/mqttx-cli-linux-arm64
sudo install ./mqttx-cli-linux-arm64 /usr/local/bin/mqttx

Windows

Windows users should go to the MQTT X release page and find the exe package for the corresponding system architecture, download it manually and execute.

NPM

npm install mqttx-cli -g

Docker

docker pull emqx/mqttx-cli

docker run -it --rm emqx/mqttx-cli

Other platforms

Download packaged binaries from the MQTT X releases page.

Usage

After installing it, run mqttx on the terminal

Quickstart

Connect

mqttx conn -h 'broker.emqx.io' -p 1883 -u 'admin' -P 'public'

Subscribe

mqttx sub -t 'hello' -h 'broker.emqx.io' -p 1883

Publish

mqttx pub -t 'hello' -h 'broker.emqx.io' -p 1883 -m 'from MQTTX CLI'

Help

mqttx --help
OptionsDescription
-v, --versionoutput the version number
-h, --helpdisplay help for command
CommandDescription
checkCheck for updates
connCreate a connection and connect to MQTT Broker
pubPublish a message to a topic
subSubscribes to a topic

Connect

mqttx conn --help
OptionsDescription
-V, --mqtt-version <5/3.1.1/3.1>the MQTT version (default: 5)
-h, --hostname the broker host (default: "localhost")
-p, --port the broker port
-i, --client-id the client id
--no-cleanset the clean session flag to false (default: true)
-k, --keepalive send a ping every SEC seconds (default: 30)
-u, --username the username
-P, --password the password
-l, --protocol the protocol to use, mqtt or mqtts (default: mqtt)
--key path to the key file
--cert path to the cert file
--ca path to the ca certificate
--insecuredo not verify the server certificate
-up, --user-properties <USERPROPERTIES...>the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli")
--will-topic the will topic
--will-message the will message
--will-qos <0/1/2>the will qos
--will-retainsend a will retained message (default: false)
--helpdisplay help for conn command

Subscribe

mqttx sub --help
OptionsDescription
-V, --mqtt-version <5/3.1.1/3.1>the MQTT version (default: 5)
-h, --hostname the broker host (default: "localhost")
-p, --port the broker port
-i, --client-id the client id
-q, --qos <0/1/2>the QoS of the message (default: 0)
--no-cleanset the clean session flag to false (default: true)
-t, --topic the message topic
-k, --keepalive send a ping every SEC seconds (default: 30)
-u, --username the username
-P, --password the password
-l, --protocol the protocol to use, mqtt or mqtts (default: mqtt)
-nl, --no_localthe no local MQTT 5.0 flag
-rap, --retain-as-publishedthe retain as published MQTT 5.0 flag
-rh, --retain-handling <0/1/2>the retain handling MQTT 5.0
--key path to the key file
--cert path to the cert file
--capath to the ca certificate
--insecuredo not verify the server certificate
-up, --user-properties <USERPROPERTIES...>the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli")
--will-topic the will topic
--will-message the will message
--will-qos <0/1/2>the will qos
--will-retainsend a will retained message (default: false)
-v, --verboseprint the topic before the message
--helpdisplay help for sub command

Publish

mqttx pub --help
OptionsDescription
-V, --mqtt-version <5/3.1.1/3.1>the MQTT version (default: 5)
-h, --hostname the broker host (default: "localhost")
-p, --port the broker port
-i, --client-id the client id
-q, --qos <0/1/2>the QoS of the message (default: 0)
-t, --topic the message topic
-m, --messagethe message body (default: "Hello From MQTT X CLI")
-r, --retainsend a retained message (default: false)
-s, --stdinread the message body from stdin
-M, --multilineread lines from stdin as multiple messages
-u, --username the username
-P, --password the password
-l, --protocol the protocol to use, mqtt or mqtts (default: mqtt)
--key path to the key file
--cert path to the cert file
--capath to the ca certificate
--insecuredo not verify the server certificate
-up, --user-properties <USERPROPERTIES...>the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli")
--will-topic the will topic
--will-message the will message
--will-qos <0/1/2>the will qos (default: 0)
--will-retainsend a will retained message (default: false)
--helpdisplay help for pub command

Better Together with EMQX

MQTT X is designed to connect to test MQTT Brokers such as EMQX, The one-click connection and simple graphical interface make it easy to connect to EMQX or EMQX Cloud to debug and explore functional features.

Sign up EMQX Cloud for 14 days free trial

Download EMQX locally right now

Get Involved

Develop

Recommended version for Node environment:

  • v14.*.*
# Clone
git clone git@github.com:emqx/MQTTX.git

# Install dependencies
cd MQTTX/cli
yarn install

# Compiles and hot-reloads for development
yarn run dev

# Compiles and minifies for production
yarn run build

After a successful build, the corresponding file for the successful build will appear in the dist directory and will need to be used in a Node.js environment.

If you need to package a binary executable, please refer to the following command.

# Install pkg lib
npm install pkg -g

# Build binary
pkg package.json

After a successful build, you will see the binary executable for each system in the release directory.

Contributing

Please make sure to read the Contributing Guide before making a pull request.

Technology Stack

License

Apache License 2.0, see LICENSE.