Application Protocols · Study deck
CoAP and MQTT: Brokers and Selection Evidence
A protocol is a set of rules for sending messages.
Broker Bex is your guide for this deck.
After studying this chapter
Learning objectives
You will be able to:
- Explain: The team must decide whether a broker, a service that passes messages, should keep session and delivery state, or whether endpoints, the devices at each end, should talk directly.
- Explain: The direct side removes that hop and can reduce latency, but each client must know endpoints and own retry, discovery, and repeated delivery.
- Explain: The point is not merely to count hops, but to expose which component owns discovery, fan-out, retry, and offline delivery.
- Explain: The hybrid path keeps constrained CoAP exchanges local and makes the gateway validate, translate, buffer, and publish into MQTT.
Major section
Start With the Situation
A protocol is a set of rules for sending messages.
- Two protocols can meet the payload budget, the limit on data in each message, and the energy budget.
- Yet they can put responsibility in different places.
- The team must decide whether a broker, a service that passes messages, should keep session and delivery state, or whether endpoints, the devices at each end, should talk directly.
Major section
Tradeoff: Broker-Based (MQTT) vs Direct Communication (CoAP/HTTP)
The point is not merely to count hops, but to expose which component owns discovery, fan-out, retry, and offline delivery.
- Tradeoff: the broker becomes critical infrastructure and adds one extra hop.
- Tradeoff: clients must handle retries, discovery, and repeated fan-out themselves.
Major section
Tradeoff: Broker-Based (MQTT) vs Direct Communication (CoAP/HTTP) (continued)
The hybrid path keeps constrained CoAP exchanges local and makes the gateway validate, translate, buffer, and publish into MQTT.
- That third route is not a free compromise: the gateway becomes an explicit reliability and operations boundary.
- The selection bullets below should therefore be read as ownership choices, not protocol popularity.
- The direct side removes that hop and can reduce latency, but each client must know endpoints and own retry, discovery, and repeated delivery.
Major section
Summary
CoAP uses UDP with request-response pattern; MQTT uses TCP with publish-subscribe.
- CoAP has 4-byte minimum header; MQTT has 2-byte minimum header (plus TCP overhead).
- CoAP offers optional reliability (CON/NON); MQTT provides QoS 0/1/2 levels.
- Factor in existing ecosystem and tooling support for your platform.
Deck summary
Key takeaways
A protocol is a set of rules for sending messages.
- The point is not merely to count hops, but to expose which component owns discovery, fan-out, retry, and offline delivery.
- The hybrid path keeps constrained CoAP exchanges local and makes the gateway validate, translate, buffer, and publish into MQTT.
- CoAP uses UDP with request-response pattern; MQTT uses TCP with publish-subscribe.
Retrieval practice
Recall check 1 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q1Why might a system use BOTH CoAP (edge) and MQTT (cloud) in hybrid architecture?
Show answer
Answer: B Explanation: Hybrid architectures leverage protocol strengths: (1) Edge: CoAP for battery sensors → gateway (minimal power, direct queries), (2) Cloud: Gateway translates to MQTT → cloud services (pub-sub scalability, cloud platform integration).
Retrieval practice
Recall check 2 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q2A factory needs real-time (<100ms) alerts from 200 pressure sensors. Network experiences 5% packet loss. Which protocol configuration is BEST?
Show answer
Answer: B CON provides CoAP acknowledgment and retransmission, making it the best of these direct alert options.
Retrieval practice
Recall check 3 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q3What is the most fundamental architectural difference between MQTT and CoAP?
Show answer
Answer: A MQTT maintains a standing TCP connection to a broker that routes publishes to subscribers; CoAP exchanges independent UDP datagrams in a request/response style, with Observe for push.
Retrieval practice
Recall check 4 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q4A battery sensor reports once every 5 minutes and never needs commands pushed to it. Why does CoAP typically use less energy than MQTT here?
Show answer
Answer: A For infrequent reporting, the connection cost dominates.
Retrieval practice
Recall check 5 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q5Place each interaction model where it fits so you can decide whether a constrained exchange should stay direct or enter a brokered telemetry path.
Show answer
Answer: A CoAP and MQTT express different conversations: CoAP directly addresses resources, MQTT distributes topic publications through a broker, and a gateway must translate their semantics rather than merely forward bytes.
Retrieval practice
Recall check 6 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q6Complete the CoAP request (left) equivalent to an MQTT publish (right) for sending temperature data:
Show answer
Answer: A CoAP uses RESTful methods (PUT) with resource URIs while MQTT uses publish() with topic strings.
Print reference
Answers 1 of 2
Answer key.
- B · Explanation: Hybrid architectures leverage protocol strengths: (1) Edge: CoAP for battery sensors → gateway (minimal power, direct queries), (2) Cloud: Gateway translates to MQTT → cloud services (pub-sub scalability, cloud platform integration).
- B · CON provides CoAP acknowledgment and retransmission, making it the best of these direct alert options.
- A · MQTT maintains a standing TCP connection to a broker that routes publishes to subscribers; CoAP exchanges independent UDP datagrams in a request/response style, with Observe for push.
Print reference
Answers 2 of 2
Answer key.
- A · For infrequent reporting, the connection cost dominates.
- A · CoAP and MQTT express different conversations: CoAP directly addresses resources, MQTT distributes topic publications through a broker, and a gateway must translate their semantics rather than merely forward bytes.
- A · CoAP uses RESTful methods (PUT) with resource URIs while MQTT uses publish() with topic strings.