# Iot Protocols

> IoT Protocols: MQTT and CoAP

- Skill: `j4flmao/iot-protocols` (Agent Skill)
- Install (CLI): `npx skillmds@latest add j4flmao/iot-protocols`
- Raw SKILL.md: https://api.skillmd.com/api/skills/j4flmao/iot-protocols/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: j4flmao (https://skillmd.com/u/j4flmao)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/j4flmao/iot-protocols

---

# IoT Protocols: MQTT and CoAP

MQTT is a lightweight publish-subscribe protocol running over TCP/IP. It defines three Quality of Service (QoS) levels: QoS 0 (at most once), QoS 1 (at least once, requiring a PUBACK), and QoS 2 (exactly once, using a four-step handshake). 

CoAP (Constrained Application Protocol) is designed for UDP-based networks. It maps HTTP semantics to a compact binary format, utilizing a fixed 4-byte header. CoAP supports request/response patterns and multicast, making it suitable for lossy networks (LLNs) where TCP overhead is prohibitive.

```mermaid
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
flowchart TD
    subgraph PubPublisher ["Publisher<br><br><br>"]
        A[Sensor] -->|"Publish(QoS1)"| B[MQTT Broker]
    end
    subgraph SubSubscriber ["Subscriber<br><br><br>"]
        B -->|"Deliver()"| C[Backend Service]
        C -->|"PUBACK()"| B
    end
```

