← Back to the chapter

Technical detail · CoAP Observe Freshness Contracts

CoAP Observe ordering, wraparound and freshness

CoAP Observe lets a client receive continuing resource updates, called notifications; the client compares their Observe sequence values before replacing its accepted state.

A representation is the resource data in a particular format and version; freshness is the time for which accepted data may be treated as current. A Confirmable message (CON) requests an acknowledgement, a reply confirming receipt.

The Observe value is up to 24 bits wide and wraps back to the low end of its range. RFC 7641 compares the accepted value V1 received at T1 with the arriving value V2 received at T2. Accept the new notification as fresher if any of these tests passes:

Thus 16777214 followed shortly by 1 passes the second comparison. More than 128 seconds after the accepted notification, the time test permits the later arrival regardless of value. Exactly 128 seconds does not satisfy that test; evaluate the other comparisons.

If all tests fail, do not replace the accepted representation or renew freshness. Message-level handling, including acknowledgement of a recognized CON message, remains separate. Sequence gaps do not count missed physical events.

← Back to the chapter