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:
- Device connects to MQTT broker
- Publisher sends data to topic
- Broker receives data
- Broker forwards message
- 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:
- Client sends request
- Server receives request
- Server processes request
- 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
- Sender creates data packets (datagrams).
- Packets are sent directly to the receiver.
- Receiver accepts packets if they arrive.
- 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
| Feature | UDP | TCP |
|---|---|---|
| Full Form | User Datagram Protocol | Transmission Control Protocol |
| Connection | Connectionless | Connection-oriented |
| Speed | Faster | Slower |
| Reliability | Low | High |
| Error Checking | Basic | Extensive |
| Packet Ordering | Not guaranteed | Guaranteed |
| Applications | Streaming, Gaming, IoT | Web, 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.
Comments
Post a Comment