2. Agenda
• Origins
• Core characteristics
• MQTT Model
• Message format
• QOS and publish flow
• Connect and subscribe sequence
• Keep alive timer
• Topic wildcards
• MQTT beyond TCP
3. Origins
• Originally developed by IBM and Eurotech until version 3.1 to
transport telemetry data from oil stations to the central data centers
• In 2014 it was adopted by OASIS and published as 3.1.1
4. Core characteristics
• What is MQTT?
• A lightweight message queueing and transport protocol used mostly for transporting
telemetry data
• Built on top of agreement that network is unreliable
• Why
• Network is very unreliable
• Devices have very low compute power
• TCP/IP has to be present, though it can be replaced with anything with similar characteristics
• Key features:
• Lightweight (Low protocol overhead)
• Supports any duplex transport
• Reliable
• Decouples publisher and consumer
• Event based (not synchronous)
6. MQTT Model continue..
• Terminologies
• MQTT Client (or sometimes publisher, subscriber)
• Clients subscribe to topic to publish and receive message, note that a client can be both
publisher and subscriber at the same time.
• MQTT Server (or broker)
• Servers Receive messages from clients and forward to interested clients based on their
subscriptions.
• Messages
• MQTT is message based protocol and not a stream protocol
• MQTT Topics
• Are mostly used to create topics (In a sense they are simply a queues)
7. MQTT Model continue..
• Terminologies
• Session
• An stablished attachment of a device to the server, note that in MQTT a session is not
mandatory attached to a connection.
• Subscriptions
• A logical attachment of client to a topic, In other words a client subscribes to a topic and
then the server will forward messages to that client.
• Types of subscriptions
• Transient
• Durable
10. QOS and publish flow
• MQTT adds 3 QOS levels on top of what TCP provides in case the
connection breaks down while a message is being in transit.
• Levels
• 0: At most once
• Only guaranteed by underlying network protocol, aka fire and forget
• 1: At least once
• Guaranteed to be arrived but dose not guarantee that there are no duplicates.
• 2: Exactly one
• Guaranteed to be arrived just once.
13. Keep alive timer
• Sets the maximum amount of time interval between client messages
• It’s something similar to a typical TCP heartbeat scenario
• Typically implemented as a cancellation request on top of underlying
TCP socket handle on the OS
14. MQTT beyond TCP
• There are a number of other networks that have their own transport
layers such as WSN which has ZigBee here is an example for WSN