nRF51 IoT SDK
|
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.
For more details, visit http://mqtt.org.
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.
A detailed description of the MQTT client examples playing the Publisher and Subscriber Role is found here: