Testing the MQTT TLS configuration with command-line tools

We will use the mosquitto_sub command-line utility included in Mosquitto to try to generate a simple MQTT client that subscribes to a topic and prints all the messages it receives. We will use the default configuration, to try to establish a communication with the Mosquitto server, by using the default 1883 port without a certificate authority certificate specified. Open a Terminal in macOS or Linux, or a Command Prompt in Windows, go to the directory in which Mosquitto is installed, and run the following command:

mosquitto_sub -V mqttv311 -t sensors/octocopter01/altitude -d

The mosquitto_sub utility will display the following error. The Mosquitto server is not accepting any connections ...

Get Hands-On MQTT Programming with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.