Child pages
  • COAP Communications Protocol
Skip to end of metadata
Go to start of metadata

CoAP

Constrained Application Protocol (CoAP) is an IETF standard for enabling lightweight and low overhead communications for Machine-to-Machine and Internet-of-Things applications. CoAP makes use of two message types, requests and responses, using a simple binary base header format. CoAP is by default bound to UDP and optionally to DTLS, providing a high level of communications security.

More information regarding CoAP can be found on the following link: http://coap.technology/

Free and open source implementations of CoAP clients can be found on the following link: http://coap.technology/impls.html

COAP Overview

The Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use with constrained nodes and constrained networks. The nodes often have 8-bit microcontrollers with small amounts of ROM and RAM, while constrained networks such as IPv6 over Low-Power Wireless Personal Area Networks (6LoWPANs) often have high packet error rates and a typical throughput of 10s of kbit/s.  The protocol is designed for machine- to-machine (M2M) applications such as smart energy and building automation.

CoAP provides a request/response interaction model between application endpoints, supports built-in discovery of services and resources, and includes key concepts of the Web such as URIs and Internet media types.  CoAP is designed to easily interface with HTTP for integration with the Web while meeting specialized requirements such as multicast support, very low overhead, and simplicity for constrained environments.


Labeeb IoT COAP Server

COAP is client / server protocol, as shown in the below figure:

IoT devices act as CoAP client to publish their data records via PUT requests to the Labeeb IoT Data Collection Module.


COAP Messages Format

In order to push a data records to Labeeb IoT using CoAP, the user might use the below command:

echo -n <MESSAGE> | coap put coap://<HOST>/<USERNAME>/<PWD><COAP_URI>

where:

  • <MESSAGE>: The message to be sent to the IoT platform. It is a CSV based message with the following format: TIMESTAMP(unixtimestamp), LONGITUDE:LATITUDE:ALTITUDE,DATA_MODEL_NAME,DATA_TYPE_NAME:DATA_TYPE_VALUE
  • <HOST>: The url of the used IoT platform. It depends on the selected deployment and your region, for example: mea.labeeb-iot.com
  • <USERNAME>: The username generated at the creation of the device template through the Labeeb IoT portal.
  • <PWD>: The defined password at the creation of the device template through the Labeeb IoT portal.
  • <COAP_URI> is the URI similar to the MQTT topic that will allow receiving/storing data for a specific data type. Currently it's defined as follow:/enterpiseName/templateName/deviceName/payload


References and Tools

  1. Firefox plugin: http://people.inf.ethz.ch/mkovatsc/copper.php

  2. CoAP Client for testing: https://github.com/mcollina/coap-cli
  3. Eclipse PONTE: https://github.com/eclipse/ponte