Constrained Application Protocol
Internet protocol suite |
---|
Application layer |
Transport layer |
Internet layer |
Link layer |
Constrained Application Protocol (CoAP) is an Internet Application Protocol for constrained devices. It enables those constrained devices to communicate with the wider Internet using similar protocols. CoAP is designed for use between Devices on the same constrained network, between Devices and general nodes on the Internet, and between Devices on different constrained networks both joined by an internet. CoAP is also being used via other mechanisms, such as SMS on mobile communication 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 core of the protocol is specified in RFC 7252; important extensions are in various stages of the standardization process.
Features
The CoRE group has designed CoAP with the following features in mind:
- 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]
With the introduction of CoAP, a complete networking stack of open-standard protocols that are suitable for constrained devices and environments becomes available.[5]
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 |
---|---|---|---|---|---|---|
aiocoap | Python 3 | RFC 7252 | Client + Server | Blockwise Transfers, Observe (partial) | MIT | https://pypi.python.org/pypi/aiocoap |
Californium | Java | RFC 7252 | Client + Server | Observe, Blockwise Transfers, DTLS | EPL+EDL | https://www.eclipse.org/californium |
cantcoap | C++/C | RFC 7252 | Client + Server | BSD | https://github.com/staropram/cantcoap | |
Canopus | Go | RFC 7252 | Client + Server | Core | Apache License 2.0 | https://github.com/zubairhamed/canopus |
CoAP implementation for Go | Go | RFC 7252 | Client + Server | Core + Draft Subscribe | MIT | https://github.com/dustin/go-coap |
CoAP.NET | C# | RFC 7252, coap-13, coap-08, coap-03 | Client + Server | Core, Observe, Blockwise Transfers | 3-clause BSD | https://github.com/smeshlink/CoAP.NET |
CoAPSharp | C#, .NET | RFC 7252 | Client + Server | Core, Observe, Block, RD | LGPL | http://www.coapsharp.com |
CoAPthon | Python | RFC 7252 | Client + Server + Forward Proxy + Reverse Proxy | Observe, Multicast server discovery, CoRE Link Format parsing, Block-wise | MIT | https://github.com/Tanganelli/CoAPthon |
Copper | JavaScript (Browser Plugin) | RFC 7252 | Client | Observe, Blockwise Transfers | 3-clause BSD | https://github.com/mkovatsc/Copper https://addons.mozilla.org/firefox/addon/copper-270430/ |
eCoAP | C | RFC 7252 | Client + Server | Core | MIT | https://gitlab.com/jobol/ecoap |
Erbium for Contiki | C | RFC 7252 | Client + Server | Observe, Blockwise Transfers | 3-clause BSD | http://www.contiki-os.org/ (er-rest-example) |
iCoAP | Objective-C | RFC 7252 | Client | Core, Observe, Blockwise Transfers | MIT | https://github.com/stuffrabbit/iCoAP |
jCoAP | Java | RFC 7252 | Client + Server | Observe, Blockwise Transfers | Apache License 2.0 | https://code.google.com/p/jcoap/ |
libcoap | C | RFC 7252 | Client + Server | Observe, Blockwise Transfers | BSD/GPL | http://sourceforge.net/projects/libcoap/develop |
lobaro-coap | C | RFC 7252 | Client + Server | Observe, Blockwise Transfers | MIT | http://www.lobaro.com/lobaro-coap |
microcoap | C | RFC 7252 | Client + Server | MIT | https://github.com/1248/microcoap | |
nCoap | Java | RFC 7252 | Client + Server | Observe | BSD | https://github.com/okleine/nCoAP |
node-coap | Javascript | RFC 7252 | Client + Server | Core, Observe, Block | MIT | https://github.com/mcollina/node-coap |
Ruby coap | Ruby | RFC 7252 | Client + Server (david) | Core, Observe, Block, RD | MIT, GPL | https://github.com/nning/coap https://github.com/nning/david |
Sensinode C Device Library | C | RFC 7252 | Client + Server | Core, Observe, Block, RD | Commercial | https://silver.arm.com/browse/SEN00 |
Sensinode Java Device Library | Java SE | RFC 7252 | Client + Server | Core, Observe, Block, RD | Commercial | https://silver.arm.com/browse/SEN00 |
Sensinode NanoService Platform | Java SE | RFC 7252 | Cloud Server | Core, Observe, Block, RD | Commercial | https://silver.arm.com/browse/SEN00 |
SMCP | C | RFC 7252 | Client + Server | Core, Observe, Block | MIT | https://github.com/darconeous/smcp |
SwiftCoAP | Swift | RFC 7252 | Client + Server | Core, Observe, Blockwise Transfers | MIT | https://github.com/stuffrabbit/SwiftCoAP |
TinyOS CoapBlip | nesC/C | coap-13 | Client + Server | Observe, Blockwise Transfers | BSD | http://docs.tinyos.net/tinywiki/index.php/CoAP |
txThings | Python (Twisted) | RFC 7252 | Client + Server | Blockwise Transfers, Observe (partial) | MIT | https://github.com/mwasilak/txThings/ |
FreeCoAP | C | RFC 7252 | Client + Server + HTTP/CoAP Proxy | DTLS/TLS | BSD | http://www.freecoap.org |
coap-rs | Rust | RFC 7252 | Client + Server | MIT | https://github.com/Covertness/coap-rs |
Proxy implementations
- Squid 3.1.9 with transparent HTTP-CoAP mapping module http://telecom.dei.unipd.it/pages/read/90/
- jcoap Proxy https://code.google.com/p/jcoap/
- Californium cf-proxy https://github.com/mkovatsc/Californium
- CoAPthon https://github.com/Tanganelli/CoAPthon
- FreeCoAP http://www.freecoap.org
CoAP group communication
In many CoAP application domains it is essential to have the ability to address several CoAP resources as a group, instead of addressing each resource individually (e.g. to turn on all the CoAP-enabled lights in a room with a single CoAP request triggered by toggling the light switch). To address this need, the IETF has developed an optional extension for CoAP in the form of an experimental RFC: Group Communication for CoAP - RFC 7390[6] This extension relies on IP multicast to deliver the CoAP request to all group members. The use of multicast has certain benefits such as reducing the number of packets needed to deliver the request to the members. However, multicast also has its limitations such as poor reliability and being cache-unfriendly. An alternative method for CoAP group communication that uses unicasts instead of multicasts relies on having an intermediary where the groups are created. Clients send their group requests to the intermediary, which in turn sends individual unicast requests to the group members, collects the replies from them, and sends back an aggregated reply to the client.[7]
See also
References
- ↑ RFC describing Constrained Application Protocol (CoAP)
- ↑ "Integrating Wireless Sensor Networks with the Web" , Walter, Colitti 2011
- ↑ The CORE WG's IETF Area
- ↑ Best practices for HTTP-CoAP mapping implementation
- ↑ IETF Standardization in the Field of the Internet of Things (IoT): A Survey
- ↑ RFC 7390 Group Communication for CoAP
- ↑ "Flexible Unicast-Based Group Communication for CoAP-Enabled Devices" , Ishaq, I.; Hoebeke, J.; Van den Abeele, F.; Rossey, J.; Moerman, I.; Demeester, P. Sensors 2014
- ↑ Ishaq, Isam; Carels, David; Teklemariam, Girum K.; Hoebeke, Jeroen; Abeele, Floris Van den; Poorter, Eli De; Moerman, Ingrid; Demeester, Piet (2013-04-25). "IETF Standardization in the Field of the Internet of Things (IoT): A Survey". Journal of Sensor and Actuator Networks. 2 (2): 235–287. doi:10.3390/jsan2020235.