0% found this document useful (0 votes)
4 views

Module 4

Uploaded by

snehalparab183
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Module 4

Uploaded by

snehalparab183
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Module 4 : Edge to Cloud Protocol

• HTTP
• WebSocket
• Real time clients
• MQTT
• MQTT – SN
• CoAP
• STOMP
• AMQP
• Comparison of protocols

1
IoT Application layer protocol
• It is a protocols are interface between the IoT device and network
with which it will communicate.
• The function of application layer protocols are handling data formats,
presentation and server as bridge between IoT device and network
• The type of protocol used will be depending of on following factors :
1) Data latency :- How fast the data is transported.
2) Reliability :- How redundant our device communication is
3) Bandwidth :- What is volume of data to be stored.
4) Transport :- What type of transport protocol is used.

2
HTTP (Hyper Text Transfer Protocol) :-

• HTTP is used to access data on world wide web (www).


• It can be used to transfer data in form of plain text, hypertext, audio,
video etc.
• It is same as FTP (File transfer protocol) which is used to transfer files
from one host to another host.
• But simple than FTP as it uses only one connection and no control
connection to transfer the files.
• The HTTP Messages are delivered immediately between client and
server.
• Uses TCP connection
3
❖ Features of HTTP :-

1) Connection less protocol :- HTTP client initiates request to server where


server process the request and sends response to HTTP client and it disconnect
the connection after receiving the response from the server. The connection
between client & server exist only during current request and response time
only.

2) Media independent:- Both client & server know how to handle the data
content. So it is said to be media independent.

3) Stateless :- The client & server know each other only during current request.
Hence HTTP is called as stateless protocol. (Do not hold the information in
other requests).

4
❖ Messages :-

Two types of HTTP messages are


1) Request: The client initiates a transaction by sending a request
message to server. This request message consists of-

A request line

Headers

A blank line

Body
[Present only in some messages]
5
2) Response :- The server replies to the request message by sending
response message. This consists of –

Status line

Headers

A blank line

Body
[only in some messages]

6
❖ URL [Uniform Resource Locater] :-
A client that wants to access the document in Internet needs an address & to
facilitate the access of documents, the HTTP uses the concept of URL.
• URL is a standard way of specifying any kind of information on internet (www).
• The URL defines 4 parts :

Method : // Host : Port / Path

1) Method: The method of protocol is used to retrieve the document from a server
(Ex: HTTP)
2) Host: The host is computer where the information stored and computer is given
an alias name. Web pages are mostly stored in the computers which are given an
alias name called as “www“. This field is not mandatory.
7
3) Port : URL also contain port number of server. But which is optional
field. Separated between host and port with colon.
4) Path : It is the path name of file where the information is stored.
Path itself contains slashes that separate the directories from
subdirectories and files.

Disadvantages :-
a) Requires high powers to establish communication.
b) Less secure.
c) Not optimized for cellular phone.
d) Cannot be available for other clients when one client is receiving
data from that server.

8
WebSocket
• WebSocket is a bidirectional, a full duplex protocol, that is used in the client
server communication.
• It is a stateful protocol, which means the connection between client and server
will keep alive until it is terminated by either client or server.
• Format :
• ws:// www.google.com (on)
• wss:// www.google.com
• For example, let's take client server communication, there is a client which is web
browser and a server, whenever we Initiate the connection between client and
server, they both made the handshaking and decide to create a new connection
and will be alive until terminated by any of them.

9
• When the connection is established and alive, the communication
takes place using the same connection channel until it is terminated.

Request

Response Server
Client
WebSocket

• After client-server hand shaking, the client-server decide on a new


connection to keep it alive, this new connection will be known as
websocket.

10
❖Applications :-
1) Real time web application :
This uses WebSocket to show the data at the client end all the time sent by
the server. In WebSocket, data is continuously being sent in the same
connection which is already open. Hence WebSocket is faster & improves the
application performance.
Ex:- In trading website or bitcoin trading, for displaying the price fluctuation
and movement of data is continuously pushed by backend server to the client
end by WebSocket channel.

2) Gaming application :
In gaming application also data is continuously received by the server.
without establishing new connection UI gets automatically refreshed
11
3) Chat application :
Chat applications use WebSocket to establish the connection only for
exchange, publishing and broadcasting the messages among the subscribers.

Disadvantages :-
Only for real – time applications, it can be used. Can not get old data.

12
Message Queue Telemetry Transport (MQTT)
• It is a machine to machine (M2M) or IoT connectivity protocol.
• It is a TCP based protocol relying on the publish-Subscribe model.
• This communication protocol is suitable for transmitting data between
resource-constrained devices having low bandwidth & low power requirements
• This will establish communication between the multiple devices using Publish
Subscribe Model.
• All the devices will interact with each other via third party called Broker, but not
directly.
• The broker receives the messages of different topics sent by the client and filters
them.
• After that they are sent to the respective clients who have subscribed to that topic
13
• Hence client that has subscribed to a Specific topic receives all the messages
published on that topic.
Receives messages
Publi
she Filters , distribute ri b er
s c
Clien r Sub ent
t Pu h Cli
bli s
sh bli
Pu r
r i be
b sc
Su
Publish Publish Subscriber
Publisher Broker
Client Client
Subscriber

ish Pub
b l lish
Pu Su
bsc Sub
rib scrib
b li s her er Clie er
Pu t nt
Clien

Figure : Publish – Subscribe Model 14


•Advantages :-

1) Easy Scalability :
• One to many, many to many Communication is possible using this model
• Also, client can publish and also subscribe at the same time due to this
two-way communication, MQTT protocol is considered to be bi-directional
protocol.

2) Eliminates insecure connections :


• Broker is responsible for the authentication. authorization of all connected
clients.

3) Light weight communication :


• Quick, efficient and lightweight due to small code up to 256 megabytes.

15
MQTT-SN (MQTT for sensor networks)

• Similar to MQTT but some modifications are done to


1) Reduce power consumption.
2) Reduce payload size
3) Also to add standby feature.

In MQTT -SN, the transport protocol is UDP where as 20 MQTT it is TCP.


The Architecture of MQTT -IN consists of
1) Clients
2) Broker
3) MQTT-SN Gateway -> converts MQTT packets to MQTT-SN Packets

16
4) MQTT-SN forwards
✔ used when clients Cannot communicate with gateway
✔ forwards messages to gateway through internet from clients.
✔ Also receives messages from gateways to the clients unchanged.

MQTT MQTT- SN
Packets Packets
Client Broker Client
Gateway
Publisher Subscriber

Forwards

17
Constrained Application Protocol (COMP):
• It is also an applications layer protocol for machine to machine (M2M) applications.
• This protocol is a client-server-based protocol uses request-response model.
• Like HTTP, COAP is a web transfer protocol and uses UDP as Transport protocol.
• CoAP can easily interface with HTTP
• The CoAP packets can be shared between different client nodes which commanded
by COAP server.
• This model will be one-one Communication.
• The CoAP server will interpret it, extract the payload and decide what to do
depending on its logic. The server does not necessarily hav to acknowledge the
request.

18
Client

Server

19
Streaming Text Oriented Message protocol
(STOMP) :
• STOMP is an application layer protocol, which provides an
interoperable wire format so that STOMP clients can communicate
with message any STOMP broker.
• This provides easy and widespread. messaging interoperability among
many languages. platforms and broken.
• The main disadvantage of STOMP is it may be hard to implement the
server side but is very easy to write client to connect It can also get
interfaced with HTTP

20
Advanced Message Queuing Protocol (AMQP) :
• It is open standard application layar protocol.
• It also uses publish subscribe architectures.
Subscribers
Exchange Queues

Client

Publisher E
Routing

Broker Client

Figure : AMQP Architecture 21


1) Publisher : Client apps create messages which are given to broker.

2) Exchange : This is the place where publishers deliver messages. The messages
contain routing keys which are used by exchange module, in order to route
them.

3) Binding : This is the link that is setup to bind a queue to an exchange.

4) Queues : Exchange queue the message.

5) Subscriber / Consumer : Client apps subscribe messages from broker.

6) Routing Key : It is a message attribute. The exchange might look at this key
when deciding how to route the message to queues.
22
Comparison of application layer protocols :-
Criteria HTTP MQTT AMQP CoAP
Year 1997 1999 2003 2010

Architecture Client / Server Client / Broker Client / Broker or Client / Server or


Client / Server Client / Broker

Abstraction Request / Publish / Publish / Subscribe Request / Response


Response Subscribe Or Or
Request / Response Publish / Subscribe

Header size Undefined 2 Byte 8 Byte 4 Byte

Message size Large & Small & Negotiable and Small & Undefined
Undefined Undefined Undefined

23
Semantics / Get, Post, Head, Connect, Consume, Deliver, Get, Post, Put,
Methods Put, Patch, Disconnected, Publish, Get, Delete
Options, Publish, Subscribe, Select, Ask,
Connect, Delete Unsubscribe, Close Delete, Recover,
Reject, Open,
Close

Cache and proxy Yes Partial Yes Yes


support

Transport TCP TCP (MQTT – SN TCP, SCTP UDP, SCTP


Protocol can use UDP)

Security TLS / SASL TLS / SSL TLS / SSL, IPSec, DTLS, IPSec
SASL
Encoding format Text Binary Binary Binary

24

You might also like