First, we will use wildcards to subscribe to a topic filter with QoS level 2, and then we will publish one message to a topic that will match the topic filter with QoS level 2. This way, we will analyze how both publishing and subscription work with QoS level 2.
We will use the mosquitto_sub command-line utility included in Mosquitto to generate a simple MQTT client that subscribes to a topic filter with QoS level 1 and prints all the messages it receives. 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/quadcopter30/# -q 2 -d
The previous command will create ...