Wireless IoT Higher-Layer Protocols: MQTT, CoAP, DDS and AMQP
What this domain tests
CWIIP asks you to choose an application-layer protocol for a stated constraint set and to predict behaviour when a link drops, a device sleeps, or a subscriber joins late. Know the message patterns, quality-of-service mechanics, discovery and default ports cold.
MQTT (broker-centric publish/subscribe)
- Runs over TCP, 1883 plain, 8883 with TLS. A broker decouples publishers from subscribers. Topics are hierarchical;
+matches one level,#matches the remainder and must be last. - QoS 0 fire-and-forget; QoS 1 at-least-once with duplicates possible; QoS 2 exactly-once between one client and the broker via PUBLISH/PUBREC/PUBREL/PUBCOMP. Every guarantee is hop-by-hop, never end-to-end across an application.
- Retained messages store the last value on a topic and are delivered to new subscribers. The Last Will and Testament is published by the broker on ungraceful disconnect. The broker drops a silent client at 1.5x the keepalive interval.
- Clean session/clean start discards queued messages; a persistent session (MQTT 5 session expiry) lets the broker queue messages while a device sleeps.
CoAP (REST over UDP)
- RFC 7252, UDP 5683, DTLS 5684. GET, POST, PUT, DELETE map onto resource URIs with options such as Uri-Path and Content-Format.
- Four message types: CON, NON, ACK, RST. A CON is retransmitted with backoff until ACK or RST, so reliability is per-message, not per-session.
- Observe (RFC 7641) converts a GET into a subscription; block-wise transfer fragments large bodies; discovery uses
/.well-known/corewith CoRE Link Format.
DDS and AMQP
- DDS is data-centric and brokerless over RTPS/UDP, with rich QoS: reliability, durability, deadline, ownership, partition. Suits real-time control loops.
- AMQP 1.0 is brokered and session/link oriented over TCP (5672, TLS 5671), typical in enterprise and cloud back ends.
Worked example
A battery-powered cold-chain probe on NB-IoT reports every 5 minutes; the back end needs the latest reading the moment it subscribes, plus an alarm if the probe dies. MQTT answers all three: retained message on the temperature topic for the latest value, QoS 1 for alarm events, and a Last Will on an alarm topic for probe death. CoAP would force the server to poll or use Observe over an intermittent NAT, and DDS's brokerless discovery is a poor fit for sleeping cellular nodes.
Traps
- Claiming QoS 2 gives exactly-once delivery to the application.
- Thinking retained messages build a per-subscriber history; only one value per topic is kept.
- Putting
#mid-filter or expecting+to span multiple levels. - Assuming CoAP runs over TCP, or that NON messages are acknowledged.
- Assuming the client publishes its own will.