← Back to the chapter · Previous detail · Next detail →

Technical detail · CoAP Lab: Message Construction

CoAP retry timing, cache freshness and DTLS setup

A CoAP temperature client needs separate policies for retrying a request, reusing a cached reading and establishing a secure connection.

With RFC 7252 defaults, four retransmissions follow randomized waits totaling 30–45 seconds. The final acknowledgement (ACK) wait can extend failure detection to 62–93 seconds. A loss percentage alone does not determine a fixed delay. Give the application a deadline rather than waiting indefinitely for confirmation of a replaceable reading.

A cache stores responses for reuse; it can reuse a fresh GET response, the answer to a request to read a resource. Max-Age specifies the freshness lifetime of a cached response in seconds; omission defaults to 60. Choose it from the allowed reading age and inspect response age before diagnosing an unchanged temperature as a missing update.

DTLS is Datagram TLS, security protection that adds setup to a datagram exchange. A fresh handshake can dominate a short CoAP exchange. Its cost depends on version, authentication, loss and link delay. Reuse an established session where appropriate, or use the resumption mechanism supported by the deployed version.

← Back to the chapter · Previous detail · Next detail →