Message Queuing Telemetry Transport (MQTT)
MQTT is a lightweight publish / subscribe messaging protocol used for machine to machine connectivity. MQTT is best used in scenarios where code size and bandwidth should remain small.
MQTT messages are sent over TCP1883, and TCP8883 is also reserved for SSL communication. Generally SSL is avoided due to the large overhead it adds to the protocol.
MQTT relies on a broker who receives all messages from the different clients, and routes the messages to the clients who have subscribed to a ‘topic’. MQTT does not send direct messages between clients, instead it sends the message to the broker with a topic set. There may be several brokers handling different topics.
If the broker receives a message for a topic where no clients are subscribed, it discards the message.
Depending on the criticality of a message, 3 different quality of service measures can be applied.
Fire and Forget: Send it once, and no additional steps are taken to ensure delivery (least amount of overhead)
Acknowledge delivery: The message is sent multiple times until delivery is acknowledged by the broker (medium amount of overhead)
Assured delivery: A handshake occurs to ensure only one copy of the message is received (highest amount of overhead)