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

Extensible Messaging and Presence Protocol

Uploaded by

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

Extensible Messaging and Presence Protocol

Uploaded by

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

⮚ XMPP

Extensible Messaging and Presence Protocol (XMPP,


originally named Jabber) is an open communication
protocol designed for instant messaging (IM), presence
information (presence information is a status indicator that
conveys ability and willingness of a potential communication
partner), and contact list maintenance.

XMPP is designed to support real-time communication


between two or more entities, such as instant messaging,
presence information, file transfer, and video conferencing.

Based on XML (Extensible Markup Language- is a markup


language and file format for storing, transmitting, and
reconstructing arbitrary data. It defines a set of rules for
encoding documents in a format that is both human-
readable and machine-readable).

XMPP is used by a wide variety of instant messaging


applications, including the popular Jabber protocol, and it is
also used by various Internet of Things (IoT) devices for
communication.

XMPP supports end-to-end encryption, making it a secure


protocol for communication.
Designed to be extensible, the protocol offers a multitude of
applications beyond traditional IM in the broader realm
of message-oriented middleware, including signaling for VoIP,
video, file transfer, gaming and other uses.

Unlike most commercial instant messaging protocols, XMPP


is defined in an open standard in the application layer.

The architecture of the XMPP network is similar to email;


anyone can run their own XMPP server and there is no central
master server. This federated open system approach allows
users to interoperate with others on any server using a 'JID'
user account, similar to an email address.

XMPP implementations can be developed using any software


license and many server, client, and library implementations
are distributed as free and open-source software.
Numerous freeware and commercial software implementations
also exist.

Various XMPP client software are available on both desktop


and mobile platforms and devices - by 2003 the protocol was
used by over ten million people worldwide on the network,
according to the XMPP Standards Foundation.

This protocol is mostly used by instant messaging


applications like WhatsApp.
Let’s dive into each character of word XMPP:

● X : It means eXtensible. XMPP is an open source project


which can be changed or extended according to the need.

● M : XMPP is designed for sending messages in real time. It


has a very efficient push mechanism compared to other
protocols.

● P : It determines whether you are online/offline/busy. It


indicates the state.

● P : XMPP is a protocol, that is, a set of standards that allow


systems to communicate with each other.

These are the basic requirements of any Instant Messenger


which are fulfilled by XMPP:

1. Send and receive messages with other users.

2. Check and share presence status

3. Manage subscriptions to and from other users.

4. Manage contact list

5. Block communications (receive message, sharing presence


status, etc) to specific users.
XMPP is based on client-server architecture, i.e. clients
don’t communicate directly, they do it with the help of a
server as an intermediary. It is decentralized means there is
no centralized XMPP server just like email, anyone can run
their own XMPP server.

● Secure — any XMPP server may be isolated from the


public network (e.g., on a company intranet) and robust
security built into the core XMPP specifications. In
addition, the XMPP developer community is actively
working on end-to-end encryption to raise the security bar
even further.

● Extensible — using the power of XML, anyone can build


custom functionality on top of the core protocols; to
maintain interoperability,

● Flexible — XMPP applications beyond IM include network


management, content syndication, collaboration tools, file
sharing, gaming, remote systems monitoring, web
services, lightweight middleware, cloud computing, and
much more.
● Diverse — a wide range of companies and open-source
projects use XMPP to build and deploy real-time
applications and services; you will never get “locked in”
when you use XMPP technologies.

https://en.wikipedia.org/wiki/XMPP

⮚ WebSocket

WebSocket is a computer communications protocol that


provides a way for web browsers and servers to communicate
with each other in real-time. It allows for bidirectional
communication between a client and server over a single, long-
lived TCP connection.

Web sockets are defined as a two-way communication


between the servers and the clients, which means both the
parties communicate and exchange data at the same time. This
protocol defines a full duplex communication.

WebSocket was designed to overcome the limitations of


the HTTP protocol, which is primarily used for web page
requests and responses. Unlike HTTP, WebSocket provides a
persistent, low-latency communication channel that is ideal for
real-time applications such as online gaming, chat rooms, and
stock market data feeds.

Web sockets take a step forward in bringing desktop rich


functionalities to the web browsers. It represents an evolution,
which was awaited for a long time in client/server web
technology.

In computer science, handshaking is a process that


ensures the server is in sync with its clients. Handshaking is the
basic concept of Web Socket protocol. The following diagram
shows the server handshake with various clients
Web Sockets – Definition

Web sockets are defined as a two-way communication


between the servers and the clients, which means both the
parties communicate and exchange data at the same time.

The key points of Web Sockets are true concurrency


(multiple computations are happening at the same
time) and optimization of performance, resulting in more
responsive and rich web applications.

The main features of web sockets are as follows −

● Web socket protocol is being standardized, which means


real time communication between web servers and
clients is possible with the help of this protocol.

● Web sockets are transforming to cross platform standards


for real time communication between a client and the
server.

● This standard enables new kinds of applications.


Businesses for real time web applications can speed up
with the help of this technology.

● The biggest advantage of Web Socket is it provides a two-


way communication (full duplex) over a single TCP
connection.
URL

HTTP has its own set of schemas such as http and https. Web
socket protocol also has a similar schema defined in its URL
pattern.

The following image shows the Web Socket URL in tokens.

Browser Support

The latest specification of Web Socket protocol is defined


as RFC 6455 – a proposed standard.

RFC 6455 is supported by various browsers like Internet


Explorer, Mozilla Firefox, Google Chrome, Safari, and Opera.

Before diving to the need of Web sockets, it is necessary to


have a look at the existing techniques, which are used
for duplex communication between the server and the client.

Why Do We Need Web Sockets?

The Internet was created by a collection of Hypertext Mark-up


Language (HTML) pages linking one another to form a
conceptual web of information. During the course of time,
static resources increased in number and richer items, such as
images and began to be a part of the web fabric.

Server technologies advanced which allowed dynamic server


pages - pages whose content was generated based on a query.

Soon, the requirement to have more dynamic web pages leads


to the availability of Dynamic Hypertext Mark-up Language
(DHTML). All thanks to JavaScript. Over the following years, we
saw cross frame communication in an attempt to avoid page
reloads followed by HTTP Polling within frames.

However, none of these solutions offered a truly standardized


cross browser solution to real-time bi-directional
communication between a server and a client.

This gave rise to the need of Web Sockets Protocol. It gave rise
to full-duplex communication bringing desktop-rich
functionality to all web browsers. Web Socket represents a
major upgrade in the history of web communications.

Before its existence, all communication between the web


clients and the servers relied only on HTTP.
Functions of Web Sockets

Web Sockets provide a connection between the web server


and a client such that both the parties can start sending the
data.

● Web Sockets, as the name indicates, are related to the


web. Web consists of a bunch of techniques for some
browsers; it is a broad communication platform for a vast
number of devices, including desktop computers, laptops,
tablets and smartphones.

WebSocket is distinct from HTTP. Both protocols are located


at layer 7 in the OSI model and depend on TCP at layer 4.

WebSocket is supported by most modern web browsers and


web servers, and it is widely used in a variety of web
applications and services.

https://www.slideshare.net/julienlapointe/introduction-to-
websockets-presentation

⮚ Advanced Message Queuing Protocol

AMQP stands for Advanced Message Queuing Protocol. It


is a standard messaging protocol designed for exchanging
messages between applications or services. AMQP enables
reliable, secure, and interoperable messaging between
different systems, regardless of the underlying technology or
programming language.

AMQP is designed to handle large volumes of messages


and supports both point-to-point and publish-subscribe
messaging patterns. It provides features such as message
queuing, routing, and delivery, and it supports a wide range of
messaging scenarios.

One of the key benefits of AMQP is its ability to ensure


message reliability and delivery.

AMQP also provides strong security features, including


message encryption, authentication, and authorization.

AMQP is a binary, application layer protocol, designed to


efficiently support a wide variety of messaging applications and
communication patterns.

AMQP allows for various guaranteed messaging modes


specifying a message be sent:

● At-most-once (sent one time with the possibility of being


missed).
● At-least-once (guaranteeing delivery with the possibility of
duplicated messages).

● Exactly-once (guaranteeing a one-time only delivery).

https://en.wikipedia.org/wiki/
Advanced_Message_Queuing_Protocol

⮚ MQTT protocol

MQTT stands for Message Queuing Telemetry Transport.


MQTT is a machine to machine internet of things connectivity
protocol.

It is an extremely lightweight and publish-subscribe


messaging transport protocol. It is designed for use in the
Internet of Things (IoT) and other low-bandwidth, high-latency,
or unreliable network environments.This protocol is useful for
the connection with the remote location where the bandwidth
is a premium.

MQTT is based on a publish/subscribe messaging model,


where publishers send messages to a broker, which then
distributes the messages to subscribers who have expressed
interest in receiving them.

These characteristics make it useful in various situations,


including a constant environment such as for communication
machine to machine and internet of things contexts. It is a
publish and subscribe system where we can publish and receive
the messages as a client.

It makes it easy for communication between multiple


devices. It is a simple messaging protocol designed for the
constrained devices and with low bandwidth, so it's a perfect
solution for the internet of things applications.

Characteristics of MQTT

The MQTT has some unique features which are hardly found in
other protocols. Some of the features of an MQTT are given
below:

o It is a machine to machine protocol, i.e., it provides


communication between the devices.
o It is designed as a simple and lightweight messaging
protocol that uses a publish/subscribe system to exchange
the information between the client and the server.

o It does not require that both the client and the server
establish a connection at the same time.

o It provides faster data transmission, like how


WhatsApp/messenger provides a faster delivery. It's a real-
time messaging protocol.

o It allows the clients to subscribe to the narrow selection of


topics so that they can receive the information they are
looking for.

MQTT is a lightweight, publish-subscribe network protocol that


transports messages between devices. The protocol usually
runs over TCP/IP, however, any network protocol that provides
ordered, lossless, bi-directional connections can support MQTT.

It is designed for connections with remote locations


where resource constraints exist or the network bandwidth is
limited. The protocol is an open OASIS standard and
an ISO recommendation

The MQTT protocol defines two types of network entities:


a message broker and a number of clients. An MQTT broker is a
server that receives all messages from the clients and then
routes the messages to the appropriate destination clients.

An MQTT client is any device (from a micro controller up to a


fully-fledged server) that runs an MQTT library and connects to
an MQTT broker over a network.

MQTT is widely used in IoT and other machine-to-machine


(M2M) applications, where it is used to connect sensors,
actuators, and other devices to applications and services.

It is also used in other low-bandwidth or high-latency


environments such as remote monitoring and control,
telemetry, and mobile networks.

● https://www.javatpoint.com/mqtt-protocol

● https://en.wikipedia.org/wiki/MQTT

⮚ WebRTC

WebRTC (Web Real-Time Communication) is a free and


open-source project enables real-time communication between
web browsers and mobile applications via a set of APIs
(Application Programming Interfaces). It was first introduced by
Google in 2011 and has since been adopted by other major
browser vendors such as Mozilla and Microsoft.

It allows audio and video communication to work inside


web pages by allowing direct peer-to-peer communication,
eliminating the need to install plugins or download native apps.

Supported by Apple, Google, Microsoft, Mozilla,


and Opera, WebRTC specifications have been published by
the World Wide Web Consortium (W3C) and the Internet
Engineering Task Force (IETF).

WebSocket works by establishing a persistent connection


between the client and the server, allowing for messages to be
sent in both directions without the overhead of constantly
opening and closing connections. This makes it an ideal
protocol for real-time applications such as chat rooms, online
gaming, and other interactive web applications.

According to the webrtc.org website, the purpose of the


project is to "enable rich, high-quality RTC applications to be
developed for the browser, mobile platforms, and IoT devices,
and allow them all to communicate via a common set
of protocols".
WebRTC is a powerful tool that can be used to infuse Real-
Time Communications (RTC) capabilities into browsers and
mobile applications.

https://www.tutorialspoint.com/webrtc/index.htm

https://en.wikipedia.org/wiki/WebRTC

WebRTC allows you to set up peer-to-peer connections to


other web browsers quickly and easily.

To build such an application from scratch, you would need


a wealth of frameworks and libraries dealing with typical issues
like data loss, connection dropping..

With WebRTC, all of this comes built-in into the browser


out-of-the-box. This technology doesn't need any plugins or
third-party software. It is open-sourced and its source code is
freely available at http://www.webrtc.org/.

The WebRTC API includes media capture, encoding and


decoding audio and video, transportation layer, and session
management.
Media Capture

The first step is to get access to the camera and microphone of


the user's device. We detect the type of devices available, get
user permission to access these devices and manage the
stream.

Encoding and Decoding Audio and Video

It is not an easy task to send a stream of audio and video data


over the Internet. This is where encoding and decoding are
used. This is the process of splitting up video frames and audio
waves into smaller chunks and compressing them. This
algorithm is called codec.

There is an enormous amount of different codecs, which


are maintained by different companies with different business
goals. There are also many codecs inside WebRTC like H.264,
iSAC, Opus and VP8. When two browsers connect together,
they choose the most optimal supported codec between two
users. Fortunately, WebRTC does most of the encoding behind
the scenes.

Transportation Layer

The transportation layer manages the order of packets, deals


with packet loss and connects to other users. Again the
WebRTC API gives us easy access to events that tell us when
there are issues with the connection.

Session Management

The session management deals with managing, opening and


organizing connections. This is commonly called signaling. If
you transfer audio and video streams to the user it also makes
sense to transfer collateral data. This is done by
the RTCDataChannel API.

Engineers from companies like Google, Mozilla, Opera and


others have done a great job to bring this real-time experience
to the Web.

Browser Compatibility
The WebRTC standards are one of the fastest evolving on the
web, so it doesn't mean that every browser supports all the
same features at the same time. To check whether your
browser supports WebRTC or not, you may
visit http://caniuse.com/#feat=rtcpeerconnection. Throughout
all the tutorials, I recommend you to use Chrome for all the
examples.

Use Cases

The real-time web opens the door to a whole new range of


applications, including text-based chat, screen and file sharing,
gaming, video chat, and more. Besides communication you can
use WebRTC for other purposes like −

● real-time marketing

● real-time advertising

● back office communications (CRM, ERP, SCM, FFM)

● HR management

● social networking

● dating services

● online medical consultations


● financial services

● surveillance

● multiplayer games

● live broadcasting

● e-learning

You might also like