MQTT Arduino Limits: Difference between revisions

From IoT with AME
Jump to navigation Jump to search
(Created page with "MQTT =MQTT-Limits of the Arduino Environment= MQTT supports three different modes of communication (Quality of Service or QoS). ==QoS 0 "Fire and Forget" The most simp...")
 
No edit summary
Line 5: Line 5:
MQTT supports three different modes of communication (Quality of Service or QoS).
MQTT supports three different modes of communication (Quality of Service or QoS).


==QoS 0 "Fire and Forget"
==QoS 0 "Fire and Forget"==


The most simple mode is "fire and forget" (QoS = 0). The sender (a device or the broker) sends out a message and this is it. The sender won't ever know whether the message reached its target or not.  
The most simple mode is "fire and forget" (QoS = 0). The sender (a device or the broker) sends out a message and this is it. The sender won't ever know whether the message reached its target or not.  

Revision as of 12:14, 12 June 2018

MQTT

MQTT-Limits of the Arduino Environment

MQTT supports three different modes of communication (Quality of Service or QoS).

QoS 0 "Fire and Forget"

The most simple mode is "fire and forget" (QoS = 0). The sender (a device or the broker) sends out a message and this is it. The sender won't ever know whether the message reached its target or not.

This mode is a nobrainer and does not require to memorize anything about the conversation.

QoS 1 "At Least Once"

The next mode provides a confirmation whether the message was received (QoS = 1). If the sender gets a confirmation it knows the message has been received. If it doesn't get a confirmation it does not know whether the confirmation got lost or the message was not received. In this case it probably sends the message again. Which may result in sending the same message twice (namely, when the message has been received the first time but the confirmation was lost). In case of ie. reporting the status of a light bulb (on/ off) would not hurt.

This mode already requires keeping track of messages sent and responses received. "Keeping track" means using memory and code, and the Arduino has not much of both. It is possible to keep things simple by sending a message and waiting for confirmation before sending the next message. That said, yes, Arduino can support QoS 1 as well.

QoS 2 "Once and Only Once"

The most advanced mode makes sure a confirmation is provided AND the message is sent at most once (QoS = 2). This now really requires keeping track of the conversational state. While is not completely impossible for an Arduino to do this, there just won't be much memory left for the application code. I would recommend to not insist on QoS 2 but to design the application in a way that duplicate messages wan't do harm.

MQTT