CoAP Message Types
Definition
CoAP message types are the four basic delivery modes used by the Constrained Application Protocol to control how messages are transmitted and acknowledged over UDP: Confirmable (CON), Non-confirmable (NON), Acknowledgement (ACK), and Reset (RST).
These types define the reliability and handling behavior of a CoAP message. A message may require confirmation, may be sent without expecting acknowledgment, may acknowledge a confirmable message, or may indicate that a message was received but could not be processed. This message-type system is what allows CoAP to provide efficient communication over unreliable networks while keeping protocol overhead very low.
Main Content
1. Confirmable, Non-confirmable, Acknowledgement, and Reset Messages
Confirmable (CON)
A Confirmable message is used when the sender needs reliable delivery. The receiver must respond with an Acknowledgement (ACK) if it successfully receives the message. If no ACK arrives, the sender retransmits the CON message after a timeout, using exponential backoff and a limited number of retries.
Example: A smart meter sends a CON message to report critical energy usage data. Because the data is important, the meter wants confirmation that the server received it.
Non-confirmable (NON)
A Non-confirmable message is sent when reliability is not required at the protocol level. It does not expect an ACK. This reduces traffic and latency, making it ideal for periodic or frequent updates where occasional loss is acceptable.
Example: A temperature sensor sending readings every few seconds may use NON messages because missing one reading is usually not critical.
Acknowledgement (ACK)
An ACK is sent in response to a CON message to confirm that the message was received. In many cases, the ACK may also carry a response payload if the server has an immediate response ready.
Example: A door controller receives a CON request to unlock a door and sends an ACK confirming receipt, possibly with the result of the action.
Reset (RST)
A Reset message indicates that a message was received, but the recipient could not process it or does not recognize it. It can also be used to stop retransmissions.
Example: If a device receives a CoAP message for an unknown resource, it may reply with RST to indicate that the communication should not continue in that form.
2. Reliable Delivery and Communication Behavior
Retransmission mechanism for CON messages
CoAP uses retransmissions only for Confirmable messages. If no acknowledgment is received within the timeout, the message is resent. This makes the protocol reliable even over lossy wireless links where packet drops are common.
The retransmission strategy helps ensure delivery without the overhead of TCP.
Traffic reduction with NON messages
NON messages are useful when the application can tolerate some loss. Since no ACK is required, the sender saves bandwidth, reduces energy consumption, and lowers delay. This is especially important in battery-powered IoT devices.
Example: Environmental sensors may use NON for routine telemetry.
Message exchange patterns
CoAP message types support different communication flows such as request-response, piggybacked response, and separate response. A confirmable request may get an immediate response inside the ACK or a later separate response.
This flexibility makes CoAP suitable for devices that may need time to process requests.
3. Practical Use Cases and Implementation Considerations
Choosing the right message type
The application determines whether reliability matters more than speed and efficiency. Critical control commands should use CON, while periodic monitoring data can use NON.
Example: Turning on a medical alarm should use CON, but reporting room humidity every minute can use NON.
Energy efficiency in constrained devices
In battery-operated systems, reducing acknowledgments and retransmissions saves power. NON messages are therefore popular in low-power sensor networks, while CON is reserved for important transactions.
This helps extend device lifetime significantly.
Handling errors and unknown states
RST messages and duplicate detection help CoAP nodes manage network issues gracefully. Since UDP does not guarantee delivery or order, CoAP uses message IDs and type-based handling to avoid confusion and duplicate processing.
For instance, if a client retransmits a CON message because it did not see the ACK, the server can detect the duplicate and avoid performing the same action twice.
Working / Process
1. Message creation and type selection
The sender creates a CoAP message and selects the appropriate type based on the application need. If reliability is required, it uses CON; if the data is routine and can tolerate loss, it uses NON.
2. Transmission and response handling
The message is sent over UDP. If it is CON, the receiver sends an ACK or RST. If it is NON, no acknowledgment is expected. The receiver may still send its own response as a separate CoAP message if needed.
3. Retransmission, confirmation, or termination
For CON messages, the sender waits for an ACK. If none arrives, it retransmits according to CoAP’s retry rules. If an RST is received, the sender stops further attempts. This process continues until the exchange completes successfully or the message is abandoned.
Advantages / Applications
Low overhead communication
CoAP message types are minimal and efficient, making them ideal for devices with limited memory, processing power, and bandwidth.
Flexible reliability control
Developers can choose between guaranteed delivery and lightweight best-effort transmission depending on the importance of the data.
Excellent fit for IoT and sensor networks
CoAP message types are widely used in smart homes, industrial automation, healthcare devices, agriculture monitoring, and building control systems where power efficiency and simple communication are essential.
Summary
- CoAP message types control how messages are delivered and acknowledged in constrained networks.
- The four types are CON, NON, ACK, and RST.
- These types help balance reliability, speed, and energy efficiency in IoT communication.
- Important terms to remember: Confirmable, Non-confirmable, Acknowledgement, Reset.