What is Constrained Application Protocol? An Overview on Structure, and Comparisons

by Oct 4, 2020IoT Connectivity

Introduction

IoT is a group of objects interconnected via the Internet. The objects can vary from people to electronic gadgets. There are many wireless protocols for communication between different objects. Usually, we use HTTP as a means to communicate. Considering IoT, the objects are small and in some cases where we would need to just read the input from a sensor, HTTP becomes overkill for the task. Considering these small tasks in mind, Internet Engineering Task Force (IETF) developed a lightweight protocol called the Constrained Application Protocol (CoAP).

CoAP vs HTTP and CoAP vs MQTT

CoAP is a network-oriented protocol that is similar to HTTP with lower overhead and many more features like multicast which is not possible in HTTP. For a constrained network HTTP becomes too complex. CoAP is based on REST architecture. In CoAP we need to optimize the length of the datagram to satisfy the REST protocol. Unlike HTTP, CoAP has a request/response mechanism. This is to compensate for the unreliability of UDP.

HTTP vs CoAP
fig. HTTP vs CoAP

So in simpler words, CoAP is just a compression of the HTTP protocol for a constrained network and constrained devices. CoAP redesigned some of the features to accommodate low processing and low power requirement.

Message Queue Telemetry Transport (MQTT), is a publish-subscribe protocol that facilitates one-to-many communication.MQTT is a similar protocol like CoAP used for communication. There are some differences when it comes to the features. It uses TCP for communication, unlike CoAP which uses UDP. It uses a header of 2 bytes while CoAP the header size is 4 bytes. MQTT consumes more power compared to CoAP.

MQTT vs CoAP
fig. MQTT vs CoAP

Features of CoAP

Different layers of networks are governed by many protocols. TCP/IP is the main foundation for the internet. TCP and UDP are mainly employed for IoT communication. TCP is a connection-oriented protocol that makes it more complex and difficult to use on resource-constrained devices. UDP is a connectionless protocol but it is not stable. In IoT, we use UDP and combine with the application layer to improve stability. At the application layer, Since HTTP becomes overkill, we use CoAP to provide web service. The table given below summarizes different protocols in different layers and the position of CoAP.

The Constrained Application Protocol is a specialized web transfer/service protocol for lesser nodes and constrained networks. CoAP is a standard protocol to enable interaction between devices in IoT. CoAP fulfills machine to machine requirements. It helps in Asynchronous message exchanges. There is no requirement of a clock to exchange messages. CoAP has lower overhead and parsing complexity. It supports simple proxy and caching capabilities. Since it relies mainly on UDP, it supports unicast and multicast requests.

CoAP Structure Model

CoAP is an interactive model that is similar to the HTTP client/server model. It mainly consists of 2 layers. The bottom layer is designed to deal with UDP and Asynchronous Communication. The other layer ie, the request/response layer concerns the communication method and deals with request/response message.

CoAP structure model
fig. CoAP structure model

since CoAP works like a client/server model, Let us look at how Constrained Application Protocol works from the server side and the client side.

CoAP Server and Client

The message layer supports 4 types of messages: CON (confirmable), NON (non-confirmable), ACK(Acknowledgment), RST(Reset). There are mainly 2 kinds of message transport.

A) Reliable message transport: Keep transmitting messages until ACK with the same message ID. If the recipient fails to process the message, it responds by replacing ACK with RST.

fig. Reliable message transport

B) Unreliable message transport: Transporting with NON message. It doesn’t need to be ACKed but contains message ID for supervising in case of retransmission. It the recipient fails to process the message server replies to RST.

fig. Unreliable message transport

Security Protocol for CoAP

Security is important to protect the communication between devices. DTLS (Datagram transport layer security) is introduced here for the job. Security deals with integrity, authentication, and confidentiality. DTLS satisfies all of them. DTLS is an application layer protocol that protects end-to-end communication. So an end-to-end communication will make it difficult for an attacker to access the data. It uses TCP which is too complex. It solves problems like reordering and packet loss.

fig. DTLS in protocol stack

Why only DTLS?

As mentioned earlier DTLS satisfies integrity, authentication and confidentiality. It solves reordering and packet lost. It adds 3 implements as follows:

  • Packet retransmission
  • Assigning sequence number within handshake
  • Replay detection

Conclusion

This blog describes CoAP and its features.CoAP is based on HTTP protocol and is designed for constrained resource devices. It compares HTTP and CoAP. The blog also states the advantages of using CoAP for IoT . This blog also provides a corresponding security protocol DTLS.

Creating a multiplication Skill in Alexa using python

Written By Monisha Macharla

Hi, I'm Monisha. I am a tech blogger and a hobbyist. I am eager to learn and explore tech related stuff! also, I wanted to deliver you the same as much as the simpler way with more informative content. I generally appreciate learning by doing, rather than only learning. Thank you for reading my blog! Happy learning!

RELATED POSTS

What is Edge Intelligence: Architecture and Use Cases

What is Edge Intelligence: Architecture and Use Cases

Introduction With the latest advancements in AI technologies, we have noticed a significant increase in the deployment of AI-based applications and services in recent years. More recently, with the booming IoT industry in particular, billions of mobiles and IoT...

Apache Kafka vs Apache Spark : All you need to know

Apache Kafka vs Apache Spark : All you need to know

Introduction Due to the increase in the volume of data, the demand for Stream processing is on the rise. Just processing the data wouldn't be enough, it should be done quickly too so that organizations can react to changing market conditions on a real-time basis. This...

Creating a Multiplication Skill in Alexa using Python

Creating a Multiplication Skill in Alexa using Python

Introduction In this tutorial, we will be focusing on how to create a custom multiplication skill in Alexa using Python. If you're completely new to Alexa skills, you can get a brief idea about it by clicking here. Subsequently, we have posted regarding account...

Creating a Hello World Skill in Alexa using Python

Creating a Hello World Skill in Alexa using Python

Introduction In this tutorial, we will be focusing on how to create a Hello World Skill in Alexa Developer Console. This is the most basic skill, and it would give us an idea about Skill-building using Alexa's developer console. If you're completely new to Alexa, you...

Creating a custom Date-Time skill in Alexa using Python

Creating a custom Date-Time skill in Alexa using Python

Introduction In this tutorial, we will look at how to create a simple date-time skill in Alexa using Python. For this skill, the only prerequisites required are an Alexa developer account and some basic understanding of Python. Also, we have created a post on how to...

All you need to know about Amazon Alexa Skills

All you need to know about Amazon Alexa Skills

Introduction In this tutorial, we will be taking a quick look at Amazon Alexa Skills. So, let us get started with the most common question - What Is Amazon Alexa? Alexa is nothing but a cloud-based voice service provided by the tech giant Amazon. In today's world,...

Wi-Fi HaLow: IEEE 802.11ah Wireless Networking Protocol

Wi-Fi HaLow (pronounced "HEY-Low") is an IEEE 802.11ah wireless networking protocol. It was released in 2017 as an update to the IEEE 802.11-2007 wireless networking standard. It uses 900 MHz, license-exempt bands, to provide extended range Wi-Fi networks, as opposed...

What is IoT Cisco Virtualized Packet Core (VPC)?

What is IoT Cisco Virtualized Packet Core (VPC)?

In this article, we will discuss about what is Cisco Virtualized Packet Core (VPC), How it supports IOT. Finally, we discus about its use cases. What is Virtualized Packet Core (VPC)? Virtualized Packet Core (VPC) is a technology providing all services for 4G, 3G, 2G,...

10 Best FTP clients for Windows and MAC users

10 Best FTP clients for Windows and MAC users

FTP is the abbreviation for File Transfer Protocol. Its a commonly used protocol to exchange files over any network. FTP clients are specifically designed software to transfer files between PC and servers over the internet. When a file is being transferred from one...

What is DNS and How does it work?

What is DNS and How does it work?

The Internet is just a network of 'n' computers that can communicate over various communication channels. Now, anything you do on the Internet is only an exchange of information(through files, scripts, etc.) So for the exchange to happen, you need to locate the other...

VIDEOS – FOLLOW US ON YOUTUBE

EXPLORE OUR IOT PROJECTS

IoT Smart Gardening System – ESP8266, MQTT, Adafruit IO

Gardening is always a very calming pastime. However, our gardens' plants may not always receive the care they require due to our active lifestyles. What if we could remotely keep an eye on their health and provide them with the attention they require? In this article,...

How to Simulate IoT projects using Cisco Packet Tracer

In this tutorial, let's learn how to simulate the IoT project using the Cisco packet tracer. As an example, we shall build a simple Home Automation project to control and monitor devices. Introduction Firstly, let's quickly look at the overview of the software. Packet...

All you need to know about integrating NodeMCU with Ubidots over MQTT

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

All you need to know about integrating NodeMCU with Ubidots over Https

In this tutorial, let's discuss Integrating NodeMCU and Ubidots IoT platform. As an illustration, we shall interface the DHT11 sensor to monitor temperature and Humidity. Additionally, an led bulb is controlled using the dashboard. Besides, the implementation will be...

How to design a Wireless Blind Stick using nRF24L01 Module?

Introduction Let's learn to design a low-cost wireless blind stick using the nRF24L01 transceiver module. So the complete project is divided into the transmitter part and receiver part. Thus, the Transmitter part consists of an Arduino Nano microcontroller, ultrasonic...

Sending Temperature data to ThingSpeak Cloud and Visualize

In this article, we are going to learn “How to send temperature data to ThingSpeak Cloud?”. We can then visualize the temperature data uploaded to ThingSpeak Cloud anywhere in the world. But "What is ThingSpeak?” ThingSpeak is an open-source IoT platform that allows...

Amaze your friend with latest tricks of Raspberry Pi and Firebase

Introduction to our Raspberry Pi and Firebase trick Let me introduce you to the latest trick of Raspberry Pi and Firebase we'll be using to fool them. It begins with a small circuit to connect a temperature sensor and an Infrared sensor with Raspberry Pi. The circuit...

How to implement Machine Learning on IoT based Data?

Introduction The industrial scope for the convergence of the Internet of Things(IoT) and Machine learning(ML) is wide and informative. IoT renders an enormous amount of data from various sensors. On the other hand, ML opens up insight hidden in the acquired data....

Smart Display Board based on IoT and Google Firebase

Introduction In this tutorial, we are going to build a Smart Display Board based on IoT and Google Firebase by using NodeMCU8266 (or you can even use NodeMCU32) and LCD. Generally, in shops, hotels, offices, railway stations, notice/ display boards are used. They are...

Smart Gardening System – GO GREEN Project

Automation of farm activities can transform agricultural domain from being manual into a dynamic field to yield higher production with less human intervention. The project Green is developed to manage farms using modern information and communication technologies....