Unit IV
MQTT, MQTT methods and components, MQTT communication, topics and
applications, SMQTT, CoAP, CoAP message types, CoAP Request-Response model, XMPP,
AMQP features and components, AMQP frame types
—----------------------------------------------------------------------------------------------------------------------------
Message Queue Telemetry Transport Protocol (MQTT)
Message Queuing Telemetry Transport, or MQTT, is a communications protocol designed for
Internet of Things devices with extremely high latency and restricted low bandwidth. Message
Queuing Telemetry Transport is a perfect protocol for machine-to-machine (M2M)
communication since it is designed specifically for low-bandwidth, high-latency settings.
What is Message Queue Telemetry Transport Protocol(MQTT)?
MQTT is a simple, lightweight messaging protocol used to establish communication between
multiple devices. It is a TCP-based protocol relying on the publish-subscribe model.
This communication protocol is suitable for transmitting data between resource-constrained
devices having low bandwidth and low power requirements. Hence this messaging protocol is
widely used for communication in the IoT Framework.
Publish-Subscribe Model
This model involves multiple clients interacting with each other, without having any direct
connection established between them. All clients communicate with other clients only via a third
party known as a Broker.
MQTT Architecture
MQTT follows a client-server (broker) model:
1. Publisher:
○ Devices that send data to the broker (e.g., sensors, cameras).
2. Broker:
○ The central system that receives, filters, and distributes messages to relevant
subscribers.
3. Subscriber:
○ Devices that receive data from the broker by subscribing to specific topics.
Key Features of MQTT
✅ Lightweight Protocol: Ideal for devices with limited processing power and memory.
✅ Publish-Subscribe Model: Ensures efficient data distribution.
✅ Low Bandwidth Usage: Optimized for sending minimal data packets.
✅ Reliability: Supports QoS (Quality of Service) levels to manage message delivery.
✅ Scalability: Can handle thousands of connected devices efficiently.
Secure Message Queue Telemetry Transport (SMQTT)
SMQTT works as an extension to MQTT protocol. It is based on an encryption messaging
mechanism that’s why it provides a secure messaging standard. In this protocol, subscriber
sends encrypted messages to all nodes and nodes receive encrypted message and use
message after decryption. The encryption and decryption activities are carried out by using
master key.
This protocol follows four main stages i.e., Setup, Encryption, Publish, Decryption.
1. In Setup, both publisher and subscriber register themselves near broker and get master
keys.
2. In the Encryption stage, broker encrypts published message.
3. In the Published stage, broker gives encrypted data to subscribers.
4. In the Decryption stage which is last stage, data /message is decrypted by subscriber
using that master key.
Constrained Application Protocol (CoAP)
CoAP is a lightweight application layer protocol designed for resource-constrained
devices in IoT (Internet of Things) environments. It is specifically optimized for devices with
limited processing power, memory, and bandwidth.
Key Features of CoAP
✅ Lightweight Protocol: Uses minimal overhead, making it ideal for low-power
devices.
✅ RESTful Architecture: Similar to HTTP but optimized for IoT devices.
✅ UDP-Based: Operates over UDP (User Datagram Protocol) for faster, low-latency
communication.
✅ Low Power Consumption: Ideal for battery-powered sensors and devices.
✅ Resource Discovery: Supports automatic discovery of resources on connected
devices.
✅ Message Reliability: Provides Confirmable (CON) and Non-confirmable (NON) message
types for reliable communication.
CoAP Architecture
CoAP follows a client-server model and uses URIs to identify resources.
● Client: Initiates requests to perform actions like GET, POST, PUT, or DELETE.
● Server: Responds to client requests and provides the requested data or performs the
requested action.
How CoAP Works
1. The client sends a request using one of the CoAP methods (e.g., GET
/sensor/temp).
2. The server responds with the required data or acknowledgment.
3. CoAP messages are sent over UDP to reduce overhead.
Applications of CoAP
🔹 Smart Home Automation: Controls devices like lights, thermostats, and security systems.
🔹 Smart Agriculture: Monitors environmental conditions such as soil moisture and
temperature.
🔹 Healthcare Systems: Tracks vital signs from wearable health devices.
🔹 Industrial IoT: Manages sensors and actuators in manufacturing systems.
Difference Between AMQP and MQTT
Aspect AMQP (Advanced Message Queuing MQTT (Message Queue
Protocol) Telemetry Transport)
Purpose Designed for robust message Designed for lightweight, efficient
queuing, reliable communication, and communication in low-bandwidth,
complex routing in enterprise high-latency networks like IoT.
environments.
Architecture Follows a message queue model with Follows a publish-subscribe
advanced features like queues, model with a central broker that
exchanges, and bindings. handles message distribution.
Protocol Layer 7 protocol operating over Lightweight protocol based on
Type TCP/IP with extensive features. TCP/IP or WebSocket for minimal
overhead.
Message Ensures guaranteed delivery, Supports QoS (Quality of Service)
Delivery transaction support, and persistent levels for flexible delivery options
message queues. (e.g., at most once, at least once,
exactly once).
Reliability Highly reliable with message Reliable but optimized for
acknowledgment, transaction lightweight communication with
support, and failover mechanisms. minimal overhead.
Security Uses SASL (Simple Authentication Supports TLS/SSL encryption but
and Security Layer) and TLS for with simpler security features.
enhanced security.
Message Supports large message sizes Designed for small payloads in IoT
Size efficiently. systems.
Complexity More complex to configure and Easier to set up with minimal
manage due to its rich feature set. configuration.
Best Use Suitable for banking, financial Ideal for IoT devices, remote
Cases systems, and enterprise sensors, and systems with limited
applications that require complex bandwidth or low-power
routing and guaranteed delivery. requirements.
Key Takeaway:
● Choose AMQP for enterprise messaging with complex routing and high reliability.
● Choose MQTT for IoT applications where lightweight communication and low
bandwidth are crucial.
✅ AMQP → Enterprise Systems
✅ MQTT → IoT Devices and Sensors