CoAP · Study deck
CoAP Methods and Multicast
Picture a caretaker using a small panel to read a tank level and change an alarm limit.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Apply CoAP REST methods (GET, POST, PUT, DELETE) with proper idempotency semantics for IoT resource manipulation
- Implement CoAP servers and clients using Python (aiocoap) and Arduino (ESP32) for sensor data exchange
- Configure CoAP multicast addressing for group operations and network-wide resource discovery via /.well-known/core
- Demonstrate how the CoAP Observe extension enables server-push notifications, reducing energy consumption by up to 99% compared to polling
Major section
Start With the Device Menu
A read must not alter the device.
- A repeated update must not create a second record by accident.
- The action comes first; the message choice must preserve its meaning.
- A protocol is a shared set of rules for exchanging messages.
- Constrained Application Protocol (CoAP) is a compact web-style protocol for small devices and links.
Major section
Start With the Device Menu (continued)
A gateway is a device that joins unlike networks.
- If many devices receive the same request, prove that the result stays bounded and that replies do not swamp the link.
- This first menu does not settle every transport or security choice.
- The deeper sections compare methods, group delivery, updates, and related message systems so the final design matches the action rather than a familiar label.
Major section
Phoebe's Field Notes: When a Full CR2032 Cannot Supply the Pulse
The mathematical gist.: The chapter's CR2032 model holds 2,430 J at 3.00 V, but the radio sees $V_{load}=V_{oc}-IR$.
- A 20 mA pulse through 15 ohm loses 0.30 V and reaches 2.70 V; at 100 ohm it loses 2.00 V and reaches only 1.00 V.
Major section
For Beginners: What is CoAP?
You might send a long email with lots of details, or you might send a quick text message with just the essential information.
- Both get the message across, but text messages are faster and use less data especially important when you have limited battery or a slow connection.
- CoAP is like the text message version of web communication for IoT devices.
- That works great for powerful computers and smartphones with strong batteries and fast internet.
Major section
For Beginners: What is CoAP? (continued)
Regular websites use HTTP, which is like sending detailed emails with lots of extra information in headers and metadata.
- But tiny sensors running on coin batteries can't afford that luxury.
- CoAP strips away all the unnecessary extras and keeps just the essential parts: what you want to do, which resource you're accessing, and the actual data.
- The magic is that CoAP still works like the web you know.
Major section
CoAP Request Methods and Multicast
"CoAP has four magic words that do everything!" announced the microcontroller. "GET means 'tell me your value.': PUT means 'change your setting to this.': POST means 'do this action.' And: DELETE means 'remove this thing.'".
- Temperature Terry demonstrated: "When the dashboard sends me a GET, I reply with my temperature.
- When someone sends a PUT to change my sampling rate from 10 to 30 seconds, I update my setting and confirm.
- the battery loved that. "One multicast GET instead of fifty individual GETs means I save 98% of my radio energy for discovery.
Major section
Key Insights
The simulator comparisons become a protocol choice only after interaction pattern and device constraints are considered together.
- The branches describe fit, not a universal winner.
- Having chosen an interaction model, the next question is what that choice costs on the wire.
Major section
Multicast Support
Once a single exchange is clear, scale the same resource model to a group.
- Multicast helps discovery without changing what GET means.
- Unicast increases request count and sequential time with every device; multicast holds the outbound request count at one but still receives one response per participating endpoint.
- That distinction explains why discovery benefits from multicast while state-changing commands still need per-device authorization, outcome tracking, and retry decisions.
Major section
Learning Points
The resource type says what the endpoint represents, the interface says how a client should interact with it, content format says what representation to expect, and obs advertises notification support.
- The experiments below summarize ways to change that contract; each change should be checked in both the advertisement and the behavior of the discovered resource.
- Service versioning support.
Major section
Protocol Comparison
The feature tour is complete: methods name the operation, discovery finds resources, and Observe changes polling into push.
- Total message overhead directly affects both bandwidth and battery life.
- With CR2032 battery (675 mWh = 2,430 J): CoAP enables 7.7 years vs HTTP's 0.8 years of TX-only battery life.
Deck summary
Key takeaways
A read must not alter the device.
- A gateway is a device that joins unlike networks.
- The mathematical gist.: The chapter's CR2032 model holds 2,430 J at 3.00 V, but the radio sees $V_{load}=V_{oc}-IR$.
- You might send a long email with lots of details, or you might send a quick text message with just the essential information.
- Regular websites use HTTP, which is like sending detailed emails with lots of extra information in headers and metadata.
Retrieval practice
Recall check 1 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q1Which of the following CoAP method properties is correct?
Show answer
Answer: B Correct!
Retrieval practice
Recall check 2 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q2A developer is implementing a CoAP server for a smart thermostat. The thermostat should allow reading current temperature, updating the target temperature, and resetting to factory defaults. The developer writes: PUT /temperature to read values, POST /target to update settings, and GET /reset to perform factory reset. What's wrong with this design?
Show answer
Answer: B Correct!
Retrieval practice
Recall check 3 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q3Complete the CoAP PUT request to update a resource:
Show answer
Answer: A CoAP uses code=PUT for resource updates (like HTTP PUT).
Retrieval practice
Recall check 4 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q4A facility manager is deploying a new CoAP-based building automation system. There are 200 sensors from 3 different manufacturers. The installer wants to avoid manually configuring each sensor's IP address into the central management system. Which CoAP feature enables automatic sensor onboarding?
Show answer
Answer: D Correct!
Retrieval practice
Recall check 5 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q5An IoT architect is designing a smart parking system. Parking sensors detect car presence and need to update a central server. The system has these requirements: (1) Sensors are battery-powered with 5-year target life, (2) Updates are infrequent (only when state changes: car arrives/leaves), (3) No broker infrastructure exists, (4) Each sensor needs a unique addressable endpoint for maintenance. Which protocol best fits these requirements?
Show answer
Answer: B Correct!
Retrieval practice
Recall check 6 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q6Place each CoAP multicast responsibility where it lives so you can discover many constrained servers without causing an acknowledgement storm.
Show answer
Answer: A Place each CoAP multicast responsibility where it lives so you can discover many constrained servers without causing an acknowledgement storm.
Print reference
Answers
Answer key.
- B · Correct!
- B · Correct!
- A · CoAP uses code=PUT for resource updates (like HTTP PUT).
- D · Correct!
- B · Correct!
- A · Place each CoAP multicast responsibility where it lives so you can discover many constrained servers without causing an acknowledgement storm.