You are on page 1of 27

Introduction to CoAP


CoAP: CoAP is an IoT protocol.
CoAP stands for Constrained Application Protocol, and
it is defined in RFC 7252. CoAP is a simple protocol with
low overhead specifically designed for constrained
devices (such as microcontrollers) and constrained
networks.
This protocol is used in M2M data exchange and is very
2
MQTT vs CoAP

3
MQTT vs CoAP

Both MQTT and CoAP:


◎ Are open standards
◎ Are better suited to constrained environments than
HTTP
◎ Provide mechanisms for asynchronous communication
◎ Run on IP
◎ Have a range of implementations

4
CoAP the Web of Things Architecture

5
6
7
CoAP Features (1)

◎ Constrained Application Protocol (CoAP) is a simple, low overhead protocol


designed for  environments like low-end microcontrollers and constrained
networks with critical bandwidth and a  high error rate such
as 6LowPANs.
◎ It is defined by the IETF open standard RFC 7252, runs on UDP by default
but is not limited to it, as it can be implemented over other channels like TCP,
DTLS or SMS.

8
CoAP Features (2)

◎ Web protocol used in M2M with constrained


requirements
◎ Asynchronous message exchange
◎ Low overhead and very simple to parse
◎ URI and content-type support
◎ Proxy and caching capabilities

9
CoAP Protocol
Stack
11
CoAP Message Format

Ver: It is a 2 bit unsigned integer indicating the version


T: it is a 2 bit unsigned integer indicating the message type: 00 CON, 01 NON, 10 ACK, 11
RST
TKL: Token Length is the token 4 bit length
Code: It is the code response (8 bit length) 12
Message ID: It is the message ID expressed with 16 bit
CoAP Messaging
CoAP supports four different message types:
◎ Confirmable (CON)
◎ Non-confirmable (NON)
◎ Acknowledgment (ACK)
◎ Reset (RST)

13
CoAP Messaging - CON

◎ Confirmable message is a reliable message. When


exchanging messages between two endpoints, these
messages can be reliable.
◎ A Confirmable message is sent again and again until the
other party sends an acknowledge message (ACK).
◎ The ACK message contains the same ID of the
confirmable message (CON).

14
CoAP Messaging - CON

15
CoAP Messaing - RST

◎ If the server has troubles managing the incoming


request, it can send back a Rest message (RST) instead
of the Acknowledge message (ACK).

16
CoAP Messaging - NON

◎ The other message category is the Non-confirmable (NON)


messages. These are messages that don’t require an
Acknowledge by the server. For example, category belongs
messages that contain values read from sensors.

17
CoAP Request/Response Model

18
CoAP Request/Response Model

19
CoAP Application

20
CoAP Library in Python
◎ txThing, is a CoAP library based on
Python's Twisted framework.
◎ aiocoap implements CoAP natively on Python
3.4's asyncio mechanisms, and provides command
line tools for resource fetching and proxying.
◎ CoAPthon is a python library for the CoAP
protocol, with a branch available that uses the
Twisted framework.

21
Security
Because CoAP is built on top of UDP not TCP, SSL/TLS
are not available to provide security. DTLS, Datagram
Transport Layer Security provides the same assurances
as TLS but for transfers of data over UDP. Typically,
DTLS capable CoAP devices will support RSA and AES
or ECC and AES.
22
89,526,124
Whoa! That’s a big number, aren’t you proud?

23
89,526,124$
That’s a lot of money

185,244 users
And a lot of users

100%
Total success!

24
Tablet project
Show and explain your web,
app or software projects using
these gadget templates.

25
Desktop project
Show and explain your web, app or software projects using these gadget templates.
26
Thanks!
Any questions?
You can find me at:
@username & user@mail.me

27

You might also like