CoAP · Study deck
CoAP Observe: Subscriptions and Updates
CoAP is a compact request-and-response protocol for constrained devices.
Broker Bex is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Implement Server Push: Configure and build CoAP Observe for real-time notifications using RFC 7641
- Design Observer Registries: Construct server-side data structures to manage registration, notifications, and deregistration lifecycle
- Calculate Bandwidth Savings: Apply formulas to quantify Observe benefits over traditional polling for specific IoT scenarios
- Diagnose Edge Cases: Identify and resolve NAT timeout, token reuse, and ghost observer problems in deployed systems
Major section
Start With the Decision
CoAP is a compact request-and-response protocol for constrained devices.
- Observe lets a client register interest in a resource.
- An Observe relation records that registration; a notification is a later response carrying updated resource state.
- A thermostat needs fresh changes, not a flood of copies after a link returns.
Major section
In 60 Seconds
The useful result is a fresh change at the right pace, not merely an open subscription.
- A protocol means the shared rules for a message exchange.
- A broker means a service that receives and forwards named messages.
- Telemetry means measured status sent from a device.
- CoAP means Constrained Application Protocol, a compact system for small devices.
Major section
In 60 Seconds (continued)
MQTT means Message Queuing Telemetry Transport, a broker-based system.
- Register one observer, change the value, lose a notification, reconnect, and remove the observer.
- This runway does not prove every push design or energy saving.
- CoAP Observe (RFC 7641) lets a client register interest in a resource and receive notifications of updated state.
Major section
Start With the Quiet Thermostat
A thermostat does not need to ask a room sensor the same question every ten seconds when the temperature barely changes.
- It needs one registration, then a trustworthy update only when the value crosses a meaningful boundary.
- Observe is that subscription story for CoAP.
- The chapter builds from the simple "tell me when it changes" promise into registries, notification pacing, cleanup, edge cases, and evidence that the push stream saves energy instead of creating a flood.
Major section
Count Radio Wakes, Not Only Bytes
Idealised event-energy model; measure sleep current, retries, and cell behavior before predicting battery life.
- The idealised cell ledger yields 563 polling days versus 3,361 Observe days.
- The day counts are idealised projections.
- Sleep current, retries, and cell behavior remain outside this estimate.
Major section
For Beginners: Understanding Observe vs Polling
You keep asking the same question over and over, even if the answer hasn't changed.
- You ask once, then relax - they'll let you know when something changes.
- Battery life: Every time a device sends a message, it uses power.
- With Observe, you might only send 10 messages when values actually change.
Major section
Putting Numbers to It
We can quantify the exact bandwidth savings.
- Multiple clients can observe one resource, but each relationship needs its own retained state; the next sections trace registration and notification behavior inside that contract.
Major section
Observe Protocol Flow
GET + Observe 0 + token → ordered notifications → RST or cancellation → reconcile and re-register.
- Cancellation or relationship loss ends an observation.The client must re-register and reconcile the current resource value.
- A client sends RST to stop an observation.The server removes the observer relationship associated with that request.
- Notifications must belong to the live relationship.The client checks token and ordering before accepting an update.
Major section
Putting Numbers to It
If 82°C is configured as an urgent alarm threshold, crossing it sends an immediate alarm notification even inside that 60-second interval.
- where Δv=vnew−vlast is the value change and Δt=tnow−tlast is time since last notification.
- Alarm handling is a separate path; routine updates retain the cap.
- This dual-threshold policy caps the notification rate and ignores small changes.
Deck summary
Key takeaways
CoAP is a compact request-and-response protocol for constrained devices.
- The useful result is a fresh change at the right pace, not merely an open subscription.
- MQTT means Message Queuing Telemetry Transport, a broker-based system.
- A thermostat does not need to ask a room sensor the same question every ten seconds when the temperature barely changes.
- If each wake-transmit-sleep cycle costs about 3.00 mJ, energy falls from 4.32 to 0.723 J/day, an 83.3% event-energy saving.
Retrieval practice
Recall check 1 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q1A CoAP Observe design replaces polling for a fast-changing sensor. What evidence should be reviewed before accepting it?
Show answer
Answer: C CoAP Observe review should cover registration lifecycle, notification control, network state, and protocol trade-offs.
Retrieval practice
Recall check 2 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q2A client sends GET /temperature with Observe: 0 and Token: 0xAB12. The server responds with Observe: 47. What does the value 47 in the server's response represent?
Show answer
Answer: B The Observe option value in server responses and notifications is a 24-bit sequence number (0 to 16,777,215).
Retrieval practice
Recall check 3 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q3Complete the CoAP observe subscription for real-time updates:
Show answer
Answer: A CoAP Observe uses observe=0 in the GET request to register for notifications.
Retrieval practice
Recall check 4 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q4What information must the server store for each observer in the observer registry?
Show answer
Answer: B RFC 7641 identifies an observation by endpoint and token and associates it with a target resource and request options.
Retrieval practice
Recall check 5 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q5A CoAP server has 100 clients observing a temperature resource that changes 10 times per second. It currently notifies every client on every change without pacing, and its measured delivery capacity is below 1,000 notifications per second. What problem should the team fix first?
Show answer
Answer: C Rate limits or change thresholds reduce unnecessary notifications below the measured capacity, while the design must still meet its freshness contract.
Retrieval practice
Recall check 6 of 6

Broker Bex says: answer from memory, then check your reasoning.
Q6A client restarts and rejects an old Observe notification with RST. What should the server do?
Show answer
Answer: C RST says this notification no longer belongs to a live observation.
Print reference
Answers 1 of 2
Answer key.
- C · CoAP Observe review should cover registration lifecycle, notification control, network state, and protocol trade-offs.
- B · The Observe option value in server responses and notifications is a 24-bit sequence number (0 to 16,777,215).
- A · CoAP Observe uses observe=0 in the GET request to register for notifications.
- B · RFC 7641 identifies an observation by endpoint and token and associates it with a target resource and request options.
Print reference
Answers 2 of 2
Answer key.
- C · Rate limits or change thresholds reduce unnecessary notifications below the measured capacity, while the design must still meet its freshness contract.
- C · RST says this notification no longer belongs to a live observation.