nRF51 IoT SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
MQTT

Message Queue Telemetry Transport (MQTT) protocol is a lightweight machine-to-machine protocol. The protocol uses a subscribe publish model for message exchange between the machines. All messaging takes place through a messaging broker, referred to from now on as the MQTT Broker. When referring to publishers and subscribers that use the broker for messaging, they are referred to as MQTT clients.

msc_mqtt
Figure 1: MQTT Messaging Overview.

MQTT 3.1 is an OASIS standard and uses TCP as the transport protocol. Port numbers 1883 is reserved for MQTT by IANA. Port number 8883 is reserved for MQTT over SSL.

For more details, visit http://mqtt.org.


MQTT_Overall.svg
Figure 2: Setup of MQTT examples.


MQTT brokers can be hosted by cloud services like Xively or can be run locally using broker implementations. Nordic devices, being resource constrained, will be the MQTT clients.

The MQTT examples in the IoT SDK include a Publisher and a Subscriber. The topic that is published and subscribed to is led state. A button on the publisher is used to control the LED state which also is published to the broker. The subscriber changes its LED state based on the published message from the publisher.

This set of examples cannot work with each other without a broker. Mosquitto is described in the examples to be the broker.

Also, the examples use MQTT version 3.1.0. This is the version Mosquitto supports.

Certain brokers support MQTT version 3.1.1. It is possible to enable support for 3.1.1 by defining the MQTT_3_1_1 at compile time.

Note
The MQTT examples included in this version of the IoT SDK do not support the Will and QoS features of MQTT. Also, MQTT over SSL is not supported.

A detailed description of the MQTT client examples playing the Publisher and Subscriber Role is found here:

MQTT Client - Publisher

MQTT Client - Subscriber