MQTT PROTOCOL

# MQTT Protocol

## Overview

MQTT is a lightweight publish/subscribe communications protocol that uses TCP/IP (and other secondary transport mechanisms). It is designed for remote sensors to communicate with controlling devices. The specification is under a royalty-free licence. Interesting features of the protocol include the one-to-many messaging service (publish/subscribe), the Last Will/Testament feature, and the three qualities of service. You can read more about it here.

## History

MQTT was initially released in a partnership between IBM and Arcom in 1998. As of 2021-03, the latest version is v5.0.

## MQTT Brokers

Mosquitto is a very popular open-source MQTT broker.

Online test/sandbox brokers:

• <mqtt.eclipse.org>

### Mosquitto

#### Installation

Windows:

Mosquitto can be installed on Windows by downloading the pre-compiled binaries. The x64 version will be installed in a path similar to C:\Program Files\Mosquitto. You will likely want to add that directory path to your system path so that you can call mosquitto from the command line.

#### Running

If you have added the installation directory to your system path, you can invoke mosquitto with:

mosquitto


By default the above command will start a MQTT broker listening on port 1883. The broker will not run as a daemon, so you can stop the broker with Ctrl-C (or equivalent).

You can listen to all system topics by subscribing to $SYS/#. If you are experiencing problems when running mosquitto, you might want to run in verbose mode -v to print debug information, as by default very little information is printed to the command-line: $ mosquitto -v


## MQTT Clients

Paho is a popular MQTT client.