Constrained Application Protocol
Internet protocol suite |
---|
Application layer |
Transport layer |
Internet layer |
Link layer |
Constrained Application Protocol (CoAP) is a software protocol intended to be used in very simple electronics devices that allows them to communicate interactively over the Internet. It is particularly targeted for small low power sensors, switches, valves and similar components that need to be controlled or supervised remotely, through standard Internet networks. CoAP is an application layer protocol that is intended for use in resource-constrained internet devices, such as WSN nodes. CoAP is designed to easily translate to HTTP for simplified integration with the web, while also meeting specialized requirements such as multicast support, very low overhead, and simplicity.[1][2] Multicast, low overhead, and simplicity are extremely important for Internet of Things (IoT) and Machine-to-Machine (M2M) devices, which tend to be deeply embedded and have much less memory and power supply than traditional internet devices have. Therefore, efficiency is very important. CoAP can run on most devices that support UDP or a UDP analogue.
The Internet Engineering Task Force (IETF) Constrained RESTful environments (CoRE) Working Group has done the major standardization work for this protocol. In order to make the protocol suitable to IoT and M2M applications, various new functionalities have been added.[3] The protocol has completed IETF last call and is in the final stages of processing for Internet Standards documents.
Features
The CoRE group has proposed the following features for CoAP:
- RESTful protocol design minimizing the complexity of mapping with HTTP.
- Low header overhead and parsing complexity.
- URI and content-type support.
- Support for the discovery of resources provided by known CoAP services.
- Simple subscription for a resource, and resulting push notifications.
- Simple caching based on max-age.
The mapping of CoAP with HTTP is also defined, allowing proxies to be built providing access to CoAP resources via HTTP in a uniform way.[4]
Message Formats
CoAP makes use of two message types, requests and responses, using a simple binary base header format. The base header may be followed by options in an optimized Type-Length-Value format. CoAP is by default bound to UDP and optionally to DTLS, providing a high level of communications security.
Any bytes after the headers in the packet are considered the message body if any. The length of the message body is implied by the datagram length. When bound to UDP the entire message MUST fit within a single datagram. When used with 6LoWPAN as defined in RFC 4944, messages SHOULD fit into a single IEEE 802.15.4 frame to minimize fragmentation.
Implementations
Name | Programming Language | Implemented CoAP version | Client/Server | Implemented CoAP features | License | Link |
---|---|---|---|---|---|---|
libcoap | C | coap-18 | Client + Server | Observe, Blockwise Transfers | BSD/GPL | http://sourceforge.net/projects/libcoap/develop |
iCoAP | Objective-C | coap-18 | Client | Observe, Blockwise Transfers | MIT | https://github.com/stuffrabbit/iCoAP |
nCoap | Java | coap-08 | Client + Server | Observe (draft 06), Blockwise Transfers (draft 04, partially) | BSD | https://github.com/okleine/nCoAP |
jcoap | Java | coap-08? | Client + Server | Apache | http://code.google.com/p/jcoap/ | |
coapy | Python | coap-03 | Client + Server | BSD | http://sourceforge.net/projects/coapy/ | |
TinyOS CoapBlip | nesC/C | coap-13 | Client + Server | Observe, Blockwise Transfers | BSD | http://docs.tinyos.net/tinywiki/index.php/CoAP |
RESTful Contiki | C | coap-03 | Server | 3-clause BSD | http://www.contiki-os.org/ (rest-example) | |
Erbium for Contiki | C | coap-16 | Client + Server | Observe, Blockwise Transfers | 3-clause BSD | http://www.contiki-os.org/ (er-rest-example) |
Californium | Java | coap-18 | Client + Server | Observe, Blockwise Transfers, DTLS | 3-clause BSD | https://github.com/mkovatsc/Californium |
Copper | JavaScript (Browser Plugin) | coap-18 | Client | Observe, Blockwise Transfers | 3-clause BSD | https://github.com/mkovatsc/Copper https://addons.mozilla.org/de/firefox/addon/copper-270430/ |
JSCoAP | JavaScript (Library) | coap-8 | Client + Server | Observe | MIT License | |
CoAP implementation for TinyOS | nesC/C | coap-08 | ?? | ?? | http://telecom.dei.unipd.it/pages/read/90/ | |
CoAP implementation for Go | Go | coap-18 | Client + Server | Core + Draft Subscribe | MIT | https://github.com/dustin/go-coap |
Sensinode C Device Library | C | coap-12 | Client + Server | Core, Observe, Block, RD | Commercial | http://www.sensinode.com/EN/products/trial-download.html |
Sensinode Java Device Library | Java SE | coap-12 | Client + Server | Core, Observe, Block, RD | Commercial | http://www.sensinode.com/EN/products/trial-download.html |
Sensinode NanoService Platform | Java SE | coap-12 | Cloud Server | Core, Observe, Block, RD | Commercial | http://www.sensinode.com/EN/products/trial-download.html |
CoAPSharp | C#, .NET | coap-18 | Client + Server | Core, Observe, Block, RD | LGPL | http://www.coapsharp.com |
cantcoap | C++/C | coap-18 | Client + Server | BSD | https://github.com/staropram/cantcoap | |
microcoap | C | coap-18 | Client + Server | MIT | https://github.com/1248/microcoap | |
node-coap | Javascript | coap-18 | Client + Server | Core, Observe | MIT | https://github.com/mcollina/node-coap |
smcp | C | coap-14 | Client + Server | Core, Observe, Block | MIT | https://github.com/darconeous/smcp |
Proxy Implementations
- Squid 3.1.9 with transparent HTTP-CoAP mapping module http://telecom.dei.unipd.it/pages/read/90/
- jcoap Proxy http://code.google.com/p/jcoap/
- Californium cf-proxy https://github.com/mkovatsc/Californium