← Back to the chapter · Previous detail · Next detail →
Technical detail · CoAP Lab: Stack and Trace Contracts
Observe implementation and modeled exchanges
The example Observe client requests registration with observe=0, prints an initial response and then waits for notifications. “Waiting for updates…” does not prove acceptance. A live extension needs an ObservableResource, mutable reading state used by GET, calls to updated_state() on change, and task cancellation and context shutdown. The supplied client and constant-temperature server do not provide that complete runnable extension.
Evidence for such an extension would include accepted registration, changed values, a matching Token across notifications and explicit cancellation. Match the client-chosen Token together with the server endpoint. The supplied waiting loop has no timeout or cancellation branch.
The example generated timeline is a diagram, not a capture of UDP network datagrams. With six notifications, Mixed mode and CON every fifth notification, its initial exchange plus notification ACK yields nine messages. All NON gives eight; All CON gives fourteen. Those counts describe the model. Its temperatures and short delays are illustrative. A separate Observe workbench models registration, freshness and cancellation, and likewise provides model evidence.