1 of 25

Module 2�IoT Communication Protocols

2 of 25

Overview Of IoT Communication Protocols: MQTT, CoAP, HTTP/HTTPS, WebSockets

3 of 25

Introduction to IoT Communication Protocols

IoT communication protocols enable devices to exchange data efficiently and reliably.

They vary in complexity, power consumption, and use cases.

Understanding these protocols helps optimize IoT system design and performance.

4 of 25

Importance of Communication Protocols in IoT

Protocols ensure interoperability between diverse IoT devices and platforms.

They influence the scalability, security, and responsiveness of IoT networks.

Selecting the right protocol is crucial for meeting specific application requirements.

5 of 25

Overview of MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight publish/subscribe messaging protocol.

Designed for low-bandwidth, high-latency, or unreliable networks.

Widely used in IoT for its simplicity and efficiency.

6 of 25

MQTT is a lightweight publish/subscribe messaging protocol

  • Lightweight: MQTT uses minimal network resources and is easy to implement on small devices (e.g., sensors, microcontrollers).

  • Publish/Subscribe:
    • Devices don't communicate directly.
    • Instead, one device (publisher) sends a message to a topic.
    • Another device (subscriber) receives the message if it subscribed to that topic.
    • A central broker handles all the communication.

Example:�A temperature sensor publishes to topic home/room1/temp.�An app that subscribed to home/room1/temp will receive the temperature data.

7 of 25

Designed for low-bandwidth, high-latency, or unreliable networks

  • Low-bandwidth: It works well even on slow internet or mobile data.

  • High-latency: Can tolerate delays in communication.

  • Unreliable networks: Designed to handle disconnections or unstable network conditions.

This makes MQTT ideal for remote or mobile IoT applications, like:

  • Smart farming (rural areas)
  • Vehicle tracking (moving vehicles)
  • Wearables with limited data plans

8 of 25

Widely used in IoT for its simplicity and efficiency

  • Simplicity: Easy to understand and implement.

  • Efficiency: Sends small packets of data with low overhead.

  • IoT-friendly: Perfect for devices that:
    • Have limited power
    • Send small, periodic messages (e.g., temperature, humidity)

Use cases:

  • Home automation (smart lights, thermostats)
  • Industrial monitoring (machine status)
  • Healthcare (patient monitoring devices)

9 of 25

MQTT Features and Characteristics

Operates over TCP/IP for reliable delivery.

Uses a broker to manage message distribution between clients.

Quality of Service (QoS) Levels: (i)QoS levels uses MQTT to provide assurance of different levels of message delivery.

(ii)QoS 0 ensures that without any confirmation the message is delivered at most once,

(iii)QoS 1 ensures that the sender receives the acknowledgement of message delivery and the message is delivered at least once.

(iii)QoS 2 ensures that the message is delivered exactly once using a four-step handshake mechanism .

Asynchronous Communication: (i) It enables the devices to transmit and receive messages without establishment of a persistent connection.

(ii)It plays a significant role in devices with intermittent connectivity and work on low power modes to conserve energy.

10 of 25

Overview of CoAP

CoAP (Constrained Application Protocol) is a web transfer protocol designed for simple devices.

Built on UDP to minimize overhead and power consumption.

Supports request/response and observe patterns similar to HTTP.

Constrained means “to force by imposed stricture, restriction, or limitation”

11 of 25

[Server] ←→ (Client):

  • A device acting as a Client requests data from a Server.
  • Example: A temperature monitor (Client) requests readings from a thermostat (Server).

(Client) ←→ [Server]:

  • The same device may also act as a Server for another device.
  • CoAP supports "peer-to-peer" interactions, so a device can both request and serve data.

[Server] ←→ (Client) → (Client):

  • The Server now receives requests from multiple Clients.
  • This illustrates that CoAP supports many-to-one and one-to-many communications.
  • Example: A weather station (Server) provides data to multiple mobile apps (Clients).

12 of 25

CoAP Features and Characteristics

Lightweight and suitable for resource-constrained devices.

Includes built-in support for multicast communication.

Provides mechanisms for resource discovery and caching.

13 of 25

CoAP Use Cases

Smart lighting and sensor networks in building automation.

Environmental monitoring with low-power sensors.

Device management in constrained environments.

14 of 25

Overview of HTTP/HTTPS

HTTP (Hypertext Transfer Protocol) is the foundational protocol for web communication.

HTTPS adds SSL/TLS encryption for secure data transmission. SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are cryptographic protocols.

Widely used for web services and IoT device interfaces.

15 of 25

HTTP/HTTPS Features and Characteristics

Client-server architecture facilitating request-response interactions.

Supports a variety of data formats, including JSON and XML.

Easier integration with existing web infrastructure and tools.

HTTP Communication

  • Follows the request-response model.
  • Each interaction requires a new request from the client, and the server sends back a response.
  • This is stateless – once the response is sent, the connection is closed.
  • For continuous data exchange, multiple requests must be sent.

Example: A weather app asking the server for updated data every minute.

16 of 25

HTTP/HTTPS Use Cases

Cloud-based IoT applications and dashboards.

Firmware updates and device management.

Data collection from web-enabled sensors and devices.

17 of 25

Overview of WebSockets

WebSockets provide full-duplex communication channels over a single TCP connection.

Enable real-time, bidirectional communication between clients and servers.

Often used in applications requiring instant data updates.

18 of 25

WebSockets Features and Characteristics

Reduce latency by maintaining persistent connections.

Support real-time notifications and event-driven data exchange.

Compatible with standard web technologies and browsers.

19 of 25

WebSockets Use Cases

Remote device control and monitoring dashboards.

Real-time alerts and notifications in IoT systems.

Collaborative applications and live data feeds.

20 of 25

Comparing Protocols: MQTT vs CoAP

MQTT uses TCP/IP, while CoAP uses UDP for different network conditions.

MQTT features a broker-based pub/sub model, CoAP supports request/response.

Both are suitable for constrained devices but differ in reliability and complexity.

21 of 25

Comparing Protocols: HTTP/HTTPS and WebSockets

HTTP/HTTPS is request-response, suitable for web services and data retrieval.

WebSockets enable continuous, real-time communication, ideal for live updates.

HTTPS offers security, while WebSockets can be secured via wss://.

WebSocket Communication

  • Starts with a WebSocket request from the client.
  • The server sends a WebSocket accept to establish the connection.
  • After the connection is open, both client and server can send data at any time.
  • Communication is full-duplex (bi-directional and simultaneous).
  • The connection stays open until either side closes it.

Example: A real-time chat app where messages are sent and received instantly without refreshing.

22 of 25

Choosing the Right Protocol

Consider device resource constraints, network reliability, and latency requirements.

For real-time, bidirectional communication, WebSockets and MQTT are preferred.

For simple request/response interactions, HTTP/HTTPS and CoAP are suitable.

23 of 25

Security Aspects of IoT Protocols

Protocols like HTTPS and WSS provide encryption for secure data transfer.

MQTT and CoAP can incorporate security layers like TLS and DTLS.

Ensuring robust security measures is essential for protecting IoT data and devices.

24 of 25

Future Trends in IoT Protocols

Increased integration of security features and standardization.

Development of hybrid protocols for flexible communication models.

Growing adoption of edge computing to reduce data transmission needs.

25 of 25

Conclusion and Summary

Different IoT protocols serve diverse application needs based on constraints and requirements.

MQTT, CoAP, HTTP/HTTPS, and WebSockets each offer unique advantages and use cases.

Selecting the appropriate protocol is key to building efficient, secure, and scalable IoT systems.