A Web Model For Small Things
CoAP brings the request response style of the web to very constrained devices. It mirrors HTTP methods like get and put but runs over UDP with a tiny binary header so it fits low power radios.
Reliability On UDP
Because UDP does not guarantee delivery, CoAP adds a light layer of its own.
- A confirmable message asks for an acknowledgement and is retried if none arrives.
- A non confirmable message is sent once with no acknowledgement.
- A message identifier lets the sender match acknowledgements and drop duplicates.
This gives optional reliability without the weight of a full transport handshake.
Resources And Observe
Devices expose resources addressed by paths, just like web endpoints. A client can read a sensor with a get request.
- An observe option lets a client subscribe to a resource and receive updates when its value changes.
- This avoids constant polling, which saves battery.
Bridging To The Web
CoAP maps cleanly onto HTTP, so a proxy can translate between a constrained network and the wider internet. A phone app can then read a CoAP sensor through a normal web request.
Key idea
CoAP brings web style methods and resources to constrained devices over UDP, adding light confirmable messaging for reliability and an observe option to replace polling.