← Back to the chapter · Previous detail · Next detail →
Technical detail · CoAP Observe: Efficiency and Lifecycle
Observer cleanup and safe request binding after reboot
A CoAP Observe server keeps a registration for each client receiving resource updates and needs rules for removing abandoned entries.
Server cleanup has several independent triggers. A validated Reset (RST) message rejects a notification. Failed confirmable (CON) notification delivery after the retry limit supports removal. A stream using nonconfirmable (NON) notifications still needs CON liveness checks because NON alone supplies no acknowledgement (ACK) failure signal.
An optional observer lease is a separate application policy limiting how long the server keeps an observation without renewal. Defining a cleanup function is insufficient: it must execute. With periodic sweeps, an expired entry can remain until the next successfully executed sweep, and scheduler delays can extend that time. A lease duration is not an exact removal deadline.
For secure CoAP, bind requests safely after reboot. Follow RFC 9175 guidance against binding a response to the wrong request, such as a per-connection sequence that is not reused until rekeying. A Reset handling sketch that matches address and message ID needs more validation: a production stack must validate the complete endpoint and security context.