Unit IV(IOT) – MQTT, CoAP, XMPP, AMQP

 

Unit IV – MQTT, CoAP, XMPP, AMQP (Simple English Notes)

1. MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol used in IoT for communication between devices.

It works on a Publish–Subscribe model and requires low bandwidth and low power.

Features of MQTT:

  • Lightweight protocol
  • Low power consumption
  • Uses small amount of data
  • Reliable communication
  • Supports many IoT devices
  • Works over TCP/IP

Uses:

  • Smart homes
  • Healthcare devices
  • Smart agriculture
  • Industrial automation

2. MQTT Methods and Components

MQTT Components

1. Publisher

  • Device that sends data
  • Example: Temperature sensor

2. Subscriber

  • Device that receives data

3. Broker

  • Main controller of MQTT
  • Receives and distributes messages

4. Topic

  • Channel where data is sent

Example:

Temperature sensor publishes on:

home/room1/temperature


MQTT Methods

CONNECT

  • Connects client to broker

PUBLISH

  • Sends message

SUBSCRIBE

  • Receives topic messages

UNSUBSCRIBE

  • Stops receiving messages

DISCONNECT

  • Ends connection

PINGREQ/PINGRESP

  • Keeps connection alive

3. MQTT Communication

MQTT follows the Publish–Subscribe communication process

Working:

  1. Device connects to MQTT broker
  2. Publisher sends data to topic
  3. Broker receives data
  4. Broker forwards message
  5. Subscriber receives message

Flow:

Publisher → Broker → Subscriber

Example:

Temperature sensor publishes:

"30°C"

Broker sends it to mobile application.


4. MQTT Topics and Applications

MQTT Topics

Topics are labels used to organize messages.

Examples:

  • home/kitchen/light
  • office/temperature
  • smartcity/traffic

Topics create communication channels.


Applications of MQTT

Smart Homes

  • Control lights

Healthcare

  • Patient monitoring

Agriculture

  • Soil monitoring

Smart Cities

  • Traffic monitoring

Industrial Automation

  • Machine monitoring

5. SMQTT (Secure MQTT)

SMQTT means Secure MQTT.

It improves security in MQTT communication.

Security features:

  • Authentication
  • Encryption
  • Data privacy
  • Secure key management

Advantages:

  • Prevents unauthorized access
  • Protects sensitive data
  • Improves reliability

6. CoAP

Full Form:

Constrained Application Protocol

CoAP is a web transfer protocol specially designed for small IoT devices.

It uses UDP instead of TCP.

Features:

  • Lightweight
  • Low power requirement
  • Fast communication
  • Supports REST architecture
  • Suitable for constrained devices

Applications:

  • Smart homes
  • Healthcare
  • Sensor networks

7. CoAP Message Types

CoAP defines four message types:

1. Confirmable (CON)

  • Requires acknowledgement
  • Reliable communication

Example:
Important sensor data


2. Non-Confirmable (NON)

  • No acknowledgement needed

Example:
Regular updates


3. Acknowledgement (ACK)

  • Response for confirmable messages

4. Reset (RST)

  • Indicates message error

8. CoAP Request–Response Model

CoAP works similarly to HTTP.

Main request methods:

GET

  • Retrieve information

POST

  • Send new information

PUT

  • Update information

DELETE

  • Remove information

Working process:

  1. Client sends request
  2. Server receives request
  3. Server processes request
  4. Response sent back

Example:

Sensor → GET request → Server

Server → sends temperature data


9. XMPP

Full Form:

Extensible Messaging and Presence Protocol

XMPP is a communication protocol based on XML.

Originally designed for instant messaging.

Features:

  • Real-time communication
  • Open standard
  • Supports message exchange
  • Extensible architecture

Applications:

  • Chat systems
  • Video conferencing
  • IoT communication
  • Presence detection

10. AMQP

Full Form:

Advanced Message Queuing Protocol

AMQP is a protocol used for reliable message communication between applications.

Features:

  • Reliable messaging
  • Secure communication
  • Message delivery guarantee
  • Flexible routing
  • Supports queuing

Advantages:

  • High interoperability
  • Scalable
  • Supports distributed systems

Applications:

  • Banking systems
  • Cloud services
  • Enterprise applications
  • IoT communication

11. AMQP Components

1. Producer

  • Sends messages

2. Exchange

  • Receives messages and routes them

3. Queue

  • Stores messages

4. Consumer

  • Receives messages

Flow:

Producer → Exchange → Queue → Consumer


12. AMQP Frame Types

AMQP communication uses frames.

Types:

1. Method Frame

  • Sends commands

2. Header Frame

  • Contains message information

3. Body Frame

  • Contains actual data

4. Heartbeat Frame

  • Maintains connection

Important Short Notes for Exams

MQTT: Lightweight publish–subscribe protocol for IoT.

MQTT Broker: Controls communication between devices.

SMQTT: Secure version of MQTT.

CoAP: Lightweight protocol using UDP.

CoAP Message Types: CON, NON, ACK, RST.

XMPP: XML-based communication protocol.

AMQP: Reliable message queuing protocol.

AMQP Frame Types: Method, Header, Body, Heartbeat.



UDP (User Datagram Protocol)

Full Form

UDP = User Datagram Protocol

Definition

UDP is a communication protocol used for sending data over a network. It is a connectionless protocol, which means data is sent without establishing a connection between sender and receiver.

UDP works at the Transport Layer of the OSI model.


Features of UDP

  • Connectionless communication
  • Fast data transmission
  • Low overhead
  • No error checking or recovery
  • No guarantee of data delivery
  • No guarantee of packet order

Working of UDP

  1. Sender creates data packets (datagrams).
  2. Packets are sent directly to the receiver.
  3. Receiver accepts packets if they arrive.
  4. Lost packets are not retransmitted.

Flow:

Sender  →  UDP Network  →  Receiver

Advantages of UDP

  • Very fast communication
  • Low bandwidth usage
  • Simple protocol
  • Suitable for real-time applications

Disadvantages of UDP

  • Unreliable delivery
  • Packets may be lost
  • No error recovery
  • Data may arrive out of order

Applications of UDP

  • Video streaming
  • Online gaming
  • Voice calls (VoIP)
  • DNS (Domain Name System)
  • IoT protocols like CoAP

UDP vs TCP

FeatureUDPTCP
Full FormUser Datagram ProtocolTransmission Control Protocol
ConnectionConnectionlessConnection-oriented
SpeedFasterSlower
ReliabilityLowHigh
Error CheckingBasicExtensive
Packet OrderingNot guaranteedGuaranteed
ApplicationsStreaming, Gaming, IoTWeb, Email, File Transfer

Exam Definition (2 Marks)

UDP (User Datagram Protocol) is a connectionless transport-layer protocol that provides fast data transmission without guaranteeing delivery, reliability, or packet order. It is widely used in real-time applications and IoT systems.


TCP Diagram (Connection-Oriented)

TCP first establishes a connection before sending data.

Sender                                Receiver
| |
| -------- SYN ----------------------> |
| <------- SYN + ACK ----------------- |
| -------- ACK ----------------------> |
| |
| ===== Connection Established ====== |
| |
| ------- Data Packet 1 ------------> |
| <----------- ACK ------------------ |
| ------- Data Packet 2 ------------> |
| <----------- ACK ------------------ |
| |
| -------- FIN ----------------------> |
| <----------- ACK ------------------ |
| |

Key Points

  • Connection-oriented
  • Reliable
  • Acknowledgements used
  • Error checking and recovery
  • Used in HTTP, HTTPS, Email, FTP

UDP Diagram (Connectionless)

UDP sends data directly without establishing a connection.

Sender                                Receiver
| |
| ---- Data Packet 1 ---------------> |
| ---- Data Packet 2 ---------------> |
| ---- Data Packet 3 ---------------> |
| |
| No ACK, No Connection Setup |
| |

Key Points

  • Connectionless
  • Faster than TCP
  • No acknowledgements
  • No retransmission
  • Used in Gaming, Video Streaming, VoIP, CoAP

Easy Exam Diagram

TCP

Client  ---- SYN ----> Server
Client <--- SYN+ACK -- Server
Client ---- ACK ----> Server

Data Transfer

UDP

Client ---- Data ----> Server
Client ---- Data ----> Server
Client ---- Data ----> Server

TCP vs UDP (1-Line Difference)

TCPUDP
Reliable and connection-oriented     Fast and connectionless
Uses ACK     No ACK
Error recovery available     No error recovery
Slower     Faster

Memory Trick for Viva

  • TCP = Trust + Check + Protection
  • UDP = Use Direct Packets 🚀

 

Comments

Popular posts from this blog

⭐ UNIT – 3 (Easy Notes + PDF References) Wireless LAN • MAC Problems • Hidden/Exposed Terminal • Near/Far • Infrastructure vs Ad-hoc • IEEE 802.11 • Mobile IP • Ad-hoc Routing

UNIT–5 (Simplified & Easy Notes) Software Architecture Documentation

Agile software devlopment unit 1