MQTT Essentials - A Lightweight IoT Protocol

This is the code repository for MQTT Essentials - A Lightweight IoT Protocol, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.

About the Book

This step-by-step guide will help you gain a deep understanding of the lightweight MQTT protocol. We’ll begin with the specific vocabulary of MQTT and its working modes, followed by installing a Mosquitto MQTT broker. Then, you will use best practices to secure the MQTT Mosquitto broker to ensure that only authorized clients are able to publish and receive messages. Once you have secured the broker with the appropriate configuration, you will develop a solution that controls a drone with Python.

Instructions and Navigation

All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

The chapter 1 and 2 does not contain code.

The code will look like the following:

    # Replace localhost with the IP for the Mosquitto 
    # or other MQTT server 
    mqtt_server_host = "localhost" 
    mqtt_server_port = 8883 
    mqtt_keepalive = 60

You will need any computer or device capable of running Python 3.x or greater, Chrome 56.x or greater, JDK 8 or greater, and Node.js 6.7.x or greater.

In order to work with Mosquitto 1.4.11 or greater, you will need a computer with any of the operating systems supported by this version of Mosquitto. The list is available at

In order to work with Xcode 8.x, you will need a Mac computer capable of running OS X 10.11.5 or later, with 8 GB RAM.

Related Products

Suggestions and Feedback

Click here if you have any feedback or suggestions.