Thursday, December 31, 2015

A Few Notes on MQTT



MQTT decouples SUBSCRIBERS for PUBLISHERS 

- Anyone can PUBLISH and any one can SUBSCRIBE to the data. As long as the data is in the understandable format, the exchange will be smooth. 

MQTT allows wildcard subscriptions 

Some of the Published data can be as below 

scores/football/big12/Texas
scores/football/big12/TexasTech
scores/football/big12/Okalahoma
scores/football/big12/IowaState

Everyone of the above will PUBLISH to the MQTT broker. 

The interested parties and their SUBSCRIPTION can be below 

Texas Fan => scores/football/big12/Texas
Big12 Fan => scores/football/big12/+
ESPN => scores/#

+ represents single level wild card
# represents multi level wild card 

Some of the network properties of MQTT are: 

Small Packet Size: 
PUBLISH is 2-4 bytes
CONNECT is 14 bytes 
HTTP is 0.1 - 1 KB

the headers is binary payload and it is not text 
Small clients that has 30KB foot print and as well as huge memory foot print clients can be well supported at the same time 

Minimal protocol exchanges between ends. MQTT has a configurable keep alive 2 byte PINGREQ/PINGRES

MQTT supports QoS for reliable messaging:
There are 3 QoS levels 
1. QoS 0: at most once  (PUBLISH) 
- Doesn’t survive failure
- Doesn’t repeat 

2. QoS 1: At least once (PUBLISH, PUBLIC ACK) 
Survives connection loss
can be duplicated 
3. QoS 2 : exactly once (PUBLISH, PUBREC, PUBREL, PUBCOMP)
Service connection loss,
Never duplicated 



References:

No comments:

Post a Comment