MQTT CLI 1.2.0 released
The HiveMQ team is pleased to announce the availability of MQTT CLI 1.2.0.
This release expands the CLI with a new command to quickly test MQTT brokers and adds two output options for the subscribe command.
New Features
Test Broker Command
The new Test command can be used to quickly test the supported features and limitations of an MQTT broker. You can lookup all options of this command in the official CLI documentation.
# Use the test command against our public MQTT broker
$ mqtt test -h broker.hivemq.com
MQTT 3: OK
- Maximum topic length: 65535 bytes
- QoS 0: Received 10/10 publishes in 47,59ms
- QoS 1: Received 10/10 publishes in 68,87ms
- QoS 2: Received 10/10 publishes in 73,18ms
- Retain: OK
- Wildcard subscriptions: OK
- Shared subscriptions: OK
- Payload size: >= 100000 bytes
- Maximum client id length: 65535 bytes
- Unsupported Ascii Chars: ALL SUPPORTED
MQTT 5: OK
- Connect restrictions:
> Retain: OK
> Wildcard subscriptions: OK
> Shared subscriptions: OK
> Subscription identifiers: OK
> Maximum QoS: 2
> Receive maximum: 10
> Maximum packet size: 268435460 bytes
> Topic alias maximum: 5
> Session expiry interval: Client-based
> Server keep alive: Client-based
JSON Output for Subscribe
The Subscribe command now supports JSON formatted output. Simply include the -J
option to format publishes that are received as JSON. If the payload is recognized as JSON, it is also formatted accordingly.
$ mqtt sub -t mqtt-cli -h broker.hivemq.com -J
{
"topic": "mqtt-cli",
"payload": {
"product": "mqtt-cli",
"type": "release",
"version": "1.2.0",
"feature-list": [
"JsonOutput",
"TopicOutput",
"TestCommand"
]
},
"qos": "AT_MOST_ONCE",
"receivedAt": "2020-04-02 11:15:10",
"retain": true
}
Topic Output for Subscribe
When you subscribe to a wildcard topic, it is often useful to know from which specific topic a publish was received. The Subscribe command now supports a -T
option to explicitly print out this topic with the publish message.
# Subscribe to the wildcard topic test/+ on our public MQTT broker with the -T option
$ mqtt sub -t test/+ -h broker.hivemq.com -T
test/pi: Honor 7c
test/bug: -3801340
test/tag1: oky
test/teste: alo
test/temp: 22
test/A0: 3
Improvements
Reading in password files with the
-pw:file
option now ignores trailing newlines.The logging format and output of the logfile are now much tidier.
Miscellaneous
The jar file of a new release is now included in the release assets on GitHub.
The homebrew package size was decreased by half.
MQTT CLI 1.2.0 is supported on all main operating systems like Windows, OS X and Linux. You can find the installation instructions for your operating system in the official CLI documentation.
If you have any ideas on how to improve the CLI further or notice any bugs, please let us know on GitHub or send us a mail!
Have a great day,
Till from the HiveMQ Team

Till Seeberger
Till is a software engineer at HiveMQ, driving innovation forward in the Internet of Things. He is a tenured member of the engineering team at HiveMQ and maintains the MQTT CLI open-source project. He spends his free time playing guitar and volleyball.