MQTT

MQTT

Tags
Engineering
IoT
Created
Mar 4, 2022 07:14 AM
Edited
Mar 3, 2022
Description
MQTT is a popular protocol in IoT industries
  • Largely used on IoT devices
  • Pub-sub mechanism
  • Mostly run on TCP/IP
  • Requires a broker to route messages in topics
  • Lightweight
  • For resource-constraint clients and low-bandwidth environments
 
If the connection from a subscribing client to a broker is broken, then the broker will buffer messages and push them out to the subscriber when it is back online.

Quality of Service (QoS)

At most once (0) – the message is sent only once and the client and broker take no additional steps to acknowledge delivery (fire and forget). At least once (1) – the message is re-tried by the sender multiple times until acknowledgement is received (acknowledged delivery). Exactly once (2) – the sender and receiver engage in a two-level handshake to ensure only one copy of the message is received (assured delivery).

How lightweight is MQTT?

  • 2 bytes of fixed header
  • A message payload up to 256MB that contains data and QoS

Other pros over HTTP

  • An MQTT connection can be reused multiple times, so it has less overhead to construct request packet than HTTP

Source