‣ IoT Communication Models (Short Version)

Definition: Defines how IoT devices, servers, & applications exchange data → enables M2M & M2H interaction.


1. Request–Response Model:
Client–Server based → Client sends request, Server sends response.
Stateless → each transaction independent.
Protocols: HTTP, CoAP.


2. Publish–Subscribe Model (Pub–Sub):
Entities → Publisher, Broker, Consumer.
Publisher → sends message to Broker → delivers to Subscribers.
Asynchronous → no direct link between Publisher & Subscriber.
Protocols: MQTT, AMQP, DDS.


3. Push–Pull Model:
Producer pushes → QueueConsumer pulls.
Queue = buffer → handles rate mismatch.
Flow control → balances Producer–Consumer load.


4. Exclusive Pair Model:
Bi-directional, full-duplex link between Client & Server.
Connection stays open till closed manually.
Stateful → continuous data exchange.
Protocol: WebSockets.


IoT Communication APIs (Short Version)

Definition: API = interface between IoT devices & Cloud services → enables command send/receive.


1. RESTful API:
Uses HTTP methods (GET, POST, PUT, DELETE); resources via URI.
Type: Stateless.
Pros: Simple, scalable, widely supported.
Cons: No real-time, higher overhead, complex at scale.
Example URI: example.com/api/tasks.


2. WebSocket API:
Full-duplex, persistent connection after initial handshake.
Type: Stateful.
Pros: Real-time, low latency, high scalability.
Cons: Complex, security risks, limited browser support.




IoT Communication Models

Definition:
IoT communication models define how IoT devices, servers, and applications exchange data over networks. These models enable machine-to-machine (M2M) and machine-to-human (M2H) interactions through various protocols and structures.

There are four main IoT communication models:


1. Request–Response Model

  • Description:
    It is a client–server-based model where the client sends a request to the server and the server responds with data.
    Each request-response pair is independent (stateless communication).

  • Working:

    • The client sends a request to the server.

    • The server processes the request, fetches the required data, and sends back a response.

  • Examples:
    HTTP (Hypertext Transfer Protocol) and CoAP (Constrained Application Protocol).

  • Key Point:
    Stateless — each transaction is independent.


2. Publish–Subscribe Model (Pub-Sub)

  • Description:
    This model has three entitiesPublisher, Broker, and Consumer.
    Publishers send data to the broker, which distributes the data to subscribed consumers.

  • Working:

    • Publisher publishes messages on a topic.

    • Broker manages topics and delivers messages.

    • Consumers subscribe to topics and receive relevant data.

  • Examples:
    MQTT (Message Queue Telemetry Transport), AMQP (Advanced Message Queue Protocol), DDS (Data Distribution Service).

  • Key Point:
    Asynchronous communication — publishers and subscribers are not directly linked.


3. Push–Pull Model

  • Description:
    A data producer pushes data into a queue, and consumers pull data from that queue.
    Queues act as buffers when there’s a mismatch between push and pull rates.

  • Working:

    • Producers push messages into queues.

    • Consumers pull messages at their own pace.

  • Key Point:
    Flow control mechanism for load balancing between producers and consumers.


4. Exclusive Pair Model

  • Description:
    This model establishes a bi-directional, full-duplex communication between client and server.
    A dedicated connection remains open until it is closed by either party.

  • Examples:
    WebSockets.

  • Key Point:
    Stateful communication — continuous data exchange until disconnection.


IoT Communication APIs

Definition:
API (Application Programming Interface) in IoT acts as an interface between IoT devices and the Internet/cloud services, allowing programs to send commands and receive data.

There are mainly two important types of IoT APIs:


1. RESTful API (Representational State Transfer API)

  • Definition:
    It follows architectural principles where resources are represented by URIs (Uniform Resource Identifiers).

  • Communication:
    Clients access resources using HTTP methods like GET, POST, PUT, DELETE.

  • Example URI:
    example.com/api/tasks

  • Advantages:

    • Simple and widely supported.

    • Scalable and stateless.

  • Disadvantages:

    • No real-time communication.

    • Higher overhead due to repetitive HTTP setup.

    • Complex in large systems.

  • Type: Stateless


2. WebSocket API

  • Definition:
    Provides bi-directional, full-duplex communication over a single, persistent connection.

  • Working:
    Once connected, data can flow both ways without reopening the connection.

  • Advantages:

    • Real-time communication.

    • Low latency and high efficiency.

    • Highly scalable — supports thousands of connections.

  • Disadvantages:

    • Complex design and implementation.

    • Potential security vulnerabilities if not handled properly.

    • Limited browser compatibility.

  • Type: Stateful