Enquiry about MQTT and HTTP

2 vues (au cours des 30 derniers jours)
Kevin Chia
Kevin Chia le 18 Sep 2021
Réponse apportée : Shubham le 30 Août 2023
Was looking through the scenarios between using MQTT and HTTP/REST API.
For REST, it states that I can retreive any historical data, such as data within a defined time range.
So does that mean MQTT won't be able to see historical data? I can see data being stored using MQTT protocol in the MATLAB charts over a period of time, isn't that historical data?
Or isit because those do not have MATLAB Analysis won't be able to see?
(Figure above uses MQTT Protocol)

Réponses (1)

Shubham
Shubham le 30 Août 2023
Hi Kevin,
In MQTT, the concept of message expiry is supported through the use of the "Message Expiry Interval" property. This property allows you to set a time-to-live (TTL) value for a message, specifying how long the message should be considered valid and deliverable by the MQTT broker.
When publishing a message, you can include the "Message Expiry Interval" property in the MQTT packet. The value of this property is a duration in seconds. If the message is not delivered to the intended recipient within the specified time, the MQTT broker will discard the message and it will not be delivered.
On the subscriber side, if a subscriber connects to a topic and there are messages with expired TTLs, the MQTT broker will not deliver those expired messages to the subscriber. The broker will only deliver messages that are within their TTL duration.
Since MQTT does not inherently store or retain messages beyond their TTL (if set), subscribers connecting to a topic may miss messages that were published before their connection. So that’s why MQTT may not be suitable for retrieving historical data within a defined time range.
Hope this helps. Thank You

Catégories

En savoir plus sur Downloads dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by