← Back to the chapter · Previous detail

Technical detail · CoAP Observe: Subscriptions and Updates

Sequence wraparound and the arrival-time rule

13.8 Deep Dive: Observe Internals

A CoAP Observe notification is a later response to a continuing GET request, and its Observe option carries a sequence value used to decide whether the resource value is newer.

The Observe sequence is 24-bit and can wrap. Within 128 seconds of the freshest accepted notification, the sequence comparison accepts a positive forward difference smaller than the serial half-range (half the possible sequence values), calculated modulo the sequence range (wrapping at the end). After more than 128 seconds, its arrival-time rule can accept a notification even when the sequence goes backward. Ordinary numerical comparison alone cannot handle wraparound.

An acknowledgement confirms message receipt. It does not establish that the application accepted a newer, usable value. Keep response matching (the expected peer and request token), ordering (whether the value is newer), and freshness (whether its allowed age has expired) as separate acceptance decisions.

← Back to the chapter · Previous detail