-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Hands-On MQTT Programming with Python
By :

First, we will use paho-mqtt
to create an MQTT client that connects to the Mosquitto MQTT server. We will write a few lines of Python code to establish a secured connection and subscribe to a topic.
In Chapter 3, Securing an MQTT 3.1.1 Mosquitto Server, we secured our Mosquitto server, and therefore, we will use the digital certificates we created to authenticate the client. Most of the time, we will work with an MQTT server that uses TLS, and therefore, it is a good idea to learn how to establish a connection with TLS and TLS authentication. It is easier to establish an unsecured connection with an MQTT server, but it won't be the most common scenario we will face when developing applications that work with MQTT.
First, we need to copy the following files, which we created in Chapter 3, Securing an MQTT 3.1.1 Mosquitto Server, to a directory on the computer or device we will use to run a Python script. We saved the files in a directory...