Communication Protocol
orkings of IOT application is depends on different protocols and each
W
protocol is related to IOT protocol layer.
Prof Sanjay Sharma,IPS Academy 1 Indore, 9893176328
IoT Messaging Protocols
There are a wide range of messaging and communication protocols
available, most common ones are discussed below.
1. Message Queuing Telemetry Transport (MQTT Protocol in IoT)
MQTT is an IoT communication protocol that is widely gaining popularity due
to its lightweight publish/subscribe messaging transport.
It is a protocol that transfers data between various machines.
All devices communicate through a broker or server. You can install the
broker in yourPC,MAC,LinuxsystemandeveninRaspberrypie.Twoof
the most famous brokers available inthemarketthesedaysareHIVEMQ
and Mosquito.
Clientdevicesreceiveoracceptinformationeitherfromthebrokerorbyjust
subscribing to specific topics. They can also publish specific topic
messagestothe broker.Alldevicescommunicatewitheachotherthrough
the broker.
MQTT is lightweight in size and data power transmission and it is hence
available in a large number of devices. MQTT mainly transmits its data
through the TCP/IP protocol.
There are three different kinds of QoS(quality of service):
1.QoS-0: messages are sent once, regardless of anyfeedback from the
broker. 2.QoS-1: messages are sent over and overuntil they receive a
confirmation from broker
3.QoS-2: for every message sent, broker sends a confirmationmessage back
Prof Sanjay Sharma,IPS Academy 2 Indore, 9893176328
Features of MQTT
Lightweight protocol suits best for constrained nodes
Assists publish/subscribe messaging
Reduces size of data packets
OASIS standard protocol
Pros of MQTT
Flexible options to choose from for quality of service within
functionality Easy to act upon
Quick results
Cons of MQTT
Lack of encryption
Uses high power due to the TCP connections
MQTT Use Cases
parking space with sensors that can sense empty parking spots to guide
A
vehicle in the right direction
2. Advanced Message Queuing Protocol (AMQP)
AMQP transfers business messages between various applications and
companies. AMQP has a wide range of uses in theIOT. But, it works effectively
in transferring message communication.
It connects the system, serves the system with the required information and
forwards the information to achieve the necessary goals.
AMQP connects across various systems, technologies, time and space. There
are three parts which manage the entire AMQP protocol:
Prof Sanjay Sharma,IPS Academy 3 Indore, 9893176328
Exchange: receives messages from publishers anddirects these messages
to the messaging queues depending on the availability.
Message Queue: Saves these messages in databasesuntil they are put in
use by an application.
Binding:
Distinguishes the relation between an Exchangeand Message
ueue and gives the message steering criteria.
Q
Features of AMQP
Application layer protocol is binary
Cabe used as point to point or publish/subscribe messaging
Highly suits messaging scenarios
Aids end to end encryption in communication
Pros of AMQP
Transfer messages through TCP or UDP
End to end encryption
Cons of AMQP
Uses large amounts of power and memory
Use Cases of AMQP
his protocol is mostly used in the business sector. It uses back office data
T
centres to specify devices like mobile phones, handsetsetc.
3. Data Distribution Service (DDS)
DDS protocol acts as a bridge between databases and user applications in a
network and hence it is a middleware protocol. The protocol combines the
parts of a system together.
DDS is also used for M2M communication. Data exchange happens through the
well known publish-subscribe methodology.
It serves high quality QoS to the applications with the help of multicasting. DDS
protocols are developed from low footprint devices to cloud.
DDS is data centric , Data Centricity ensures that all messages include
conceptual information and all applications requireunderstanding the data that it
receives.
Prof Sanjay Sharma,IPS Academy 4 Indore, 9893176328
Features of DDS
Designs structure supports real time systems
Publish/subscribe messaging
Direct connection of devices
Low overhead
Pros of DDS
Easy architecture that aids “auto-discovery” of new
applications Scalable and effective
Effectively uses transport bandwidth
Committed Data delivery
Cons of DDS
DDS has a heavyweight protocol and it becomes difficult to use in
embedded systems
It consumes double the bandwidth as compared to MQTT
It is not possible to interface with web pages
Use Cases of DDS
ospitals and healthcare, military and borders, wind farms, tracking
H
systems all use the DDS protocol.
4. Extensible Messaging and presence protocol(XMPP)/Jabber
XMPP applies to long distance messaging due its scalability.
XMPP originates from XML; XML originates from HTML, a protocol used to
create web pages. Both are markup languages.
XMPP has a broad range of uses due to its extensibility. It usesthestandard
internet communication protocol (ICP) and this makes it universally
communicable and it also communicates through HTTP.
Prof Sanjay Sharma,IPS Academy 5 Indore, 9893176328
XMPP networks containgatewaystoconnecttootherprotocols.Itisdesigned
in suchawaythatitsupportsinstantmessagetransferthroughTCPlink.This
is highly useful in the internet of things technology.
Features of XMPP
Extensible design
Open standards
Client/server architecture
Pros of XMPP
Labelling scheme to locate devices on the entire network
easily Cons of XMPP
End to end encryption not possible
Quality of service not available
XMPP Use Cases
Smart phones can access a smart thermostat via the internet
A gaming console that allows gamers to message other gamers instantly
5. Constrained Application Protocol (CoAP)
CoAP runs on UDP and is therefore a connectionless protocol. It is a restful,
efficient protocol and it has a header of 4 bytes.It has a lightweight protocol.
The CoAP follows the request/response protocol which is similar to HTTP, every
request must generate a certain response. Similar to HTTP, the CoAP supports
GET, POST, and PUT methods.
The CoAP is built in a way which makes HTTP interface easy and at the same
it is easily compatible with constrained nodes andnetworks.
Prof Sanjay Sharma,IPS Academy 6 Indore, 9893176328
CoAP supports 4 types of messages: confirmable, non-confirmable,
acknowledgement and rest. Confirmable and non-confirmable messages
transfer the request and response.
Features of CoAP
Low power consumption
Ideal for constrained devices
Pros of CoAP
Uses DLTS for security
Quick device communication
Packet sizes are small
Cons of CoAP
Since it is a one to one protocol there is no broadcasting
option Can be unreliable
CoAP Use Cases
Smart homes, smart cities, smart grids etc
SOAP Protocol
Simple Object Access Protocol(SOAP) is a network protocol for exchanging
structured data between nodes. It uses XML format to transfer messages. It
works ontopofapplicationlayerprotocolslikeHTTPandSMTPfornotations
and transmission.
SOAP allows processes to communicate throughout platforms, languages, and
operating system, since protocols like HTTP are already installed on all
platforms. SOAP was designed by Bob Atkinson, DonBox, Dave Winer, and
Mohsen Al Ghosein at Microsoft in 1998. SOAP was maintained by the XML
Protocol Working Group of the World Wide Web Consortiumuntil 2009.
Prof Sanjay Sharma,IPS Academy 7 Indore, 9893176328
essage Format
M
SOAP message transmits some
some basic information as given below
Information about message
message structure and instructions on processing
processingit.
Encoding instructions for application
application-defined data types.
Information aboutRemote Procedure Calls
Remote Procedure Callsand their responses.
The message in XML format contains
contains four parts
1.Envelope: This specifies that
that the XML message is a SOAP message. A
ASOAP message
is an XML document containing
containing a header and a body, both encapsulated
encapsulated within the
envelope. Any fault is included
included within the body of the message.
2.Header: This part is optional.
optional. When present, it can provide crucial
crucial information
about the applications.
3.Body: This contains the actual
within the body tags. actual message being are contained
transmitted. Faults
4.Fault:
This optional section
section contains the status of the application and
and any errors. It
should not appear more than
than once in a SOAP message.
Sample Message Block
Advantages of SOAP
SOAP is a light weight data
datainterchange protocol because it is based on
on XML.
SOAP was designed to be
OS and Platform independent.
It is built on top of HTTP which
which is installed in most systems.
It is suggested by W3 consortium
consortium which is like a governing body for the
th
e Web.
SOAP is mainly used for(APIs).
Prof Sanjay Sharma,IPS Academy
Prof Sanjay Sharma,IPS Academy 8
Indore, 9893176328
Web Services and Application
ProgrammingProgramming Interfaces
REST Web Service
EST stands for REpresentational State Transfer. It isanarchitecturalstylethat
R
provides standards between computer systems on a web service. It is a set of
constraints used to createalightweight,scalable,andmaintainablewebservice
that facilitates easy communication. It is a set of constraints used to create a
lightweight, scalable and maintainable web service that makes easy
communicationwitheachother.Allweb servicesarebasedontheREST;hence
itiscalledaRESTfulservice.Thepurposeof developingaRESTfulwebservice
is to make the web service more effective.
REST Characteristics
It is a Stateless server, supports JSON and XML and It is simple than SOAP.
It has well-maintained documentation that reflect each change in the
architectures of the REST.
It is a simple approach to build the client and server service.
It follows standard protocol such as HTTP, HTTPS and FTP.
It provides a way to connect with server-side applications.
It is based on architectural style for designing simple, lightweight, and
distributed web services compared to SOAP.
Examples of REST Systems are -Google Glass API, Amazon web services,
Atom, Tesla Model S.
Constraint and the Principles of REST
Client-Server
Stateless Server
Cacheable
Uniform Interface
Layered System
Prof Sanjay Sharma,IPS Academy 9 Indore, 9893176328
Advantage of REST
REST web services are fast as compared to SOAP because it has no
restriction like SOAP. It consumes less bandwidthand resources.
It is an architectural style for creating lightweight, scalable and maintainable
web service.
It is a language and platform-independent web service that can be written in
any programming language and run on Windows, Linuxand Mac.
REST web service helps the client machine access different formats of data
such as HTML, JSON, XML, etc. from the webserver.
SOAP Web Service REST Web Service
It stands for REpresentational State
Transfer.
It stands for Simple Object Access
Protocol.
It is XML based messaging protocol.It is not a protocol.It is an architectural style for
distributed hypermedia system.
and resources as compared to
It needs more bandwidth and resources SOAP.
for better web performance.
It is not specifically applied that the
message format must be XML or JSON,
SOAP enforces XML as a message
format. etc.
It has not great performance as It has better performance as compared to
compared to REST. SOAP, less CPU intensive, lesser code,
REST requires less bandwidth etc.
SOAP defines its security.REST inherits securitymeasures from the underlying
transport.
It does not support error handling. It has built-in error handling. SOAP
is a heavyweight XML protocol
that requires more coding to send a It is a lightweight, scalable and maintainable.
message.
It cannot be cached. It can be cached.
OAP messages are wrapped in an
S It relies on the HTTP protocol for commu
envelope and sent to any transport
mechanism such as SMTP, FTP,
HTTP or any protocol.
Prof Sanjay Sharma,IPS Academy 10 Indore, 9893176328
IP addressing
he term "IP address" refers to internet protocol address. An IP address is an identifying
T
number that is associated with a specific computer or computer network. When connected
to the internet, the IP address allows computers to send and receive information.
How IP Addresses Work
n IP address allows computers to send and receive data over the internet. Most IP
A
addresses are purely numerical, but as internet usage grows, letters have been added to
some addresses.
There are four types of IP addresses:
.Public
1
2.Private
3.Static
4.Dynamic
hile the public and private types indicate the location of the computer or computer
W
network—private being used inside a network, public being used outside of a network—
static and dynamic indicate permanency or lack thereof. You'll find more information about
the types of IP addresses in "Types of IP Addresses" below.
IOT application widely working on two types of protocols
Prof Sanjay Sharma,IPS Academy 11 Indore, 9893176328
HTTP Vs HTTPS
Prof Sanjay Sharma,IPS Academy
rof Sanjay Sharma,IPS Academy 12
P
Indore, 9893176328