...
Please make sure HiveMQ Broker is running
Setup MQTT CLI
Download MQTT CLI
Go to the release link https://hivemq.github.io/mqtt-cli/ and go to the latest release
Download the correct zip for Windows (mqtt-cli-4.25.0-win.zip on our case)
Extract the zip file
Open the command prompt and cd into the CLI folder, this folder contains mqtt-cli.exe which will be used for the next steps
Subscribe to a Topic: Subscribe to a topic using MQTT CLI with the command:
Code Block mqtt-cli.exe sub -h localhost -p 1883 -i MQTTCLIClientSUB -t "connection/test" -d
This command subscribes to the topic
connection/test
on the broker running onlocalhost
.Publish to the Same Topic: Open another command prompt window, cd to the mqttcli folder and publish a message to the same topic with:
Code Block mqtt-cli.exe pub -h localhost -p 1883 -i MQTTCLIClientPUB -t "connection/test" -m "Test MQTT CLI"
This publishes the message "Test MQTT CLI" to the
connection/test
topic.Verify Message Receipt: Check the first command prompt window where you subscribed to the topic. You should see the message "Test MQTT CLI" appear, indicating that the message was successfully published and received.
...