SlideShare a Scribd company logo
DECODING REAL TIME
WEB
AN ULTRA-COMPACT INTRO TO REAL TIME WEB
TECHNOLOGIES
Created by Amit Jain
COMET
Comet is a programming model that allows a web server to
push data to a browser.
This is often achieved through a long-held HTTP request, but
there really is no standard or specification for Comet; it is
just an umbrella term for all the different ways that can be
used to achieve this.
The different comet programming models are:
Long Polling
HTTP Streaming
Forever-frames
LONG POLLING
With long-polling, the client sends a HTTP request, waiting
for a server event. If an event occurs on the server-side, the
server sends the response including the event data.
After receiving the response containing the event data, the
client will send a request again, waiting for the next event.
There is always a pending request which allows the server to
send a response at any time.
HTTP STREAMING
With Http Streaming, the server keeps the response
message open. In contrast to long polling the HTTP
response message (body) will not be closed after sending an
event to the client.
If an event occurs on the server-side, the server will write
this event to the open response message body.
The HTTP response message body represents a
unidirectional event stream to the client.
FOREVER-FRAMES
The forever-frame technique uses HTTP 1.1 chunked
encoding to establish a single, long-lived HTTP connection
in a hidden iframe. Data is pushed incrementally from the
server to the client over this connection, and rendered
incrementally by your web browser.
As events occur, the iframe is gradually filled with script
tags, containing JavaScript to be executed in the browser.
Because browsers render HTML pages incrementally, each
script tag is executed as it is received.
COMET AND PROXY SERVERS
Long polling - provided it is implemented in a robust way,
will not suffer from too many proxy server issues, because
it is still just using the HTTP request and response model
Streaming - is more efficient but this approach suffers
from the same proxy server issues. For example, a proxy
server may be buffering the response and cause latency.
Alternatively, the proxy server may be configured to
disconnect HTTP connections that are kept open for a
certain amount of time. This is why most legacy Comet
solutions simply use long-polling.
COMET PROTOCOLS
BOSCH - http://xmpp.org/extensions/xep-0124.html,
bidirectional communication channel, can use HTTP
streaming as well as long polling
Bayeux -
http://svn.cometd.org/trunk/bayeux/bayeux.html,
bidirectional protocol, based on the long polling
approach
Uses "hacks" to break the HTTP Request-Response barrier.
This forces such protocols to implement a complex session
and connection management.
HTML5
The different HTML5 programming models are:
Server-Sent Events
WebSockets
SERVER-SENT EVENTS
HTML5 also applies the Comet communication pattern by
defining Server-Sent Events (SSE), standardizing Comet
for all standards-compliant web browsers. SSE
specification "defines an API for opening an HTTP
connection for receiving push notifications from a server."
Server-Sent Events are based on HTTP streaming. The
response stays open and event data are written as they
occur on the server side.
Server-Sent Events includes the new HTML element
EventSource as well as a new mime type text/event-
stream which defines an event framing format.
EXAMPLE CODE
The EventSource represents the client-side end point to
receive events. The client opens an event stream by creating
an EventSource, which takes an event source URL as its
constructor argument. The onmessage event handler will be
called each time new data is received.
WEBSOCKETS
A bidirectional communication channel. In contrast to
Server-Sent Events, the WebSocket protocol is not build
on top of HTTP. However, the WebSocket protocol defines
the HTTP handshake behaviour to switch an existing
HTTP connection to a lower level WebSocket connection.
The overhead involved managing a WebSocket is very
minimal. Due the fact that WebSockets is not
implemented on the top of HTTP it will not run into
trouble caused by HTTP protocol limitations.
On the other hand WebSockets, does almost nothing for
reliability. It does not include reconnect handling or
support guaranteed message delivery like Server-Sent
Event does.
Further more, as a non-HTTP based protocol, WebSocket
cannot make use of the built-in reliability features of
HTTP. This means reliability has to be implemented in the
application (sub-protocol level) when using WebSockets.
EXAMPLE CODE
WEB SOCKETS AND PROXY SERVERS
The problem with proxy servers for web applications that
have a long-lived connection (for example, Comet HTTP
streaming or HTML5 Web Sockets) is clear:
HTTP proxy servers which were originally designed for
document transfer — may choose to close streaming or
idle WebSocket connections, because they appear to be
trying to connect with an unresponsive HTTP server.
Additionally, proxy servers may also buffer unencrypted
HTTP responses, thereby introducing unpredictable
latency during HTTP response streaming.
EXAMPLE — WEBSOCKET UPGRADE
HANDSHAKE
In the case of the WebSocket upgrade request, a
transparent HTTP proxy will remove the Connection:
upgrade header, which will result in the WebSocket server
receiving a corrupt WebSocket upgrade request.
Today, most HTTP proxies are not familiar with the
WebSocket protocol.
Using secured WebSockets can avoid this effect. In
creating a secured WebSocket connection, the browser
opens an SSL connection to the WebSocket server. In this
case intermediaries will not be able to interpret or modify
data.
If a browser is configured to use an explicit proxy server
(for both encrypted and unencrypted WebSocket
connections) then it will first issue an HTTP CONNECT
method to that proxy server while establishing the
WebSocket connection.
If an unencrypted WebSocket connection (ws://) is used,
then in the case of transparent proxy servers, the browser
is unaware of the proxy server, so no HTTP CONNECT is
sent (and so it removes upgrade headers). As a result, the
connection is almost likely to fail in practice today.
If an encrypted WebSocket Secure connection (wss://) is
used, then in the case of transparent proxy servers, the
browser is unaware of the proxy server, so no HTTP
CONNECT is sent. However, since the wire traffic is
encrypted, intermediate transparent proxy servers may
simply allow the encrypted traffic through, so there is a
much better chance that the WebSocket connection will
succeed if an encrypted WebSocket connection is used.
HTML5 WEB SOCKETS AND LOAD-
BALANCING ROUTERS
Ø TCP (Layer-4) load-balancing routers should work well
with HTML5 Web Sockets, because they have the same
connection profile: connect once up front and stay
connected, rather than the HTTP document transfer
request-response profile.
Ø HTTP (Layer-7) load-balancing routers expect HTTP traffic
and can easily get confused by WebSocket upgrade traffic.
For that reason, Layer 7 load balancing routers may need to
be configured to be explicitly aware of WebSocket traffic.
HTML5 WEB SOCKETS AND
FIREWALLS
Since firewalls normally just enforce the rules for inbound
traffic rejection and outbound traffic routing (for example,
through the proxy server), there are usually no specific
WebSocket traffic-related firewall concerns.
SSE VS WEB SOCKETS
SSE Web Sockets
Unidirectional
server-to-client
channel only
Full-duplex, bidirectional
communication (not just server push)
Runs on top of
HTTP (uses
HTTP
streaming)
Highly efficient: minimal overhead
involved in managing a WebSocket,
runs on top of TCP so no HTTP hacks
SSE Web Sockets
Includes powerful
features to reconnect
and synchronize
messages
Does not include reconnect
handling or guarantee
message delivery
High reliability is a built-
in feature
No built-in reliability. This has
to be done on the application
(sub-protocol) level
Not supported by IE Supported by IE
ATTRIBUTIONS
Reveal JS
https://en.wikipedia.org/wiki/Comet_(programming)
http://www.infoq.com/articles/Web-Sockets-Proxy-
Servers
https://today.java.net/article/2010/04/26/html5-server-
push-technologies-part-2
https://today.java.net/article/2010/04/26/html5-server-
push-technologies-part-2
Q&A
THE END

More Related Content

What's hot

Http methods
Http methodsHttp methods
Http methods
maamir farooq
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
Compare Infobase Limited
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycle
Gopakumar Kunduveetil
 
HTTP
HTTPHTTP
Http
HttpHttp
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
Gökhan Şengün
 
HTTP
HTTPHTTP
Http
HttpHttp
HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developers
Mario Cardinal
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
Cathie101
 
JUG louvain websockets
JUG louvain websocketsJUG louvain websockets
JUG louvain websockets
Marc Tritschler
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
Sahil Agarwal
 
Http-protocol
Http-protocolHttp-protocol
Http-protocol
Toushik Paul
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
Akash Ashokan
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
n|u - The Open Security Community
 
HTTP Definition and Basics.
HTTP Definition and Basics.HTTP Definition and Basics.
HTTP Definition and Basics.
Halah Salih
 
Soap vs. rest - which is right web service protocol for your need?
Soap vs. rest -  which is right web service protocol for your need?Soap vs. rest -  which is right web service protocol for your need?
Soap vs. rest - which is right web service protocol for your need?
Vijay Prasad Gupta
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
Nuha Noor
 
Server-Side Programming Primer
Server-Side Programming PrimerServer-Side Programming Primer
Server-Side Programming Primer
Ivano Malavolta
 

What's hot (19)

Http methods
Http methodsHttp methods
Http methods
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycle
 
HTTP
HTTPHTTP
HTTP
 
Http
HttpHttp
Http
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
 
HTTP
HTTPHTTP
HTTP
 
Http
HttpHttp
Http
 
HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developers
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
 
JUG louvain websockets
JUG louvain websocketsJUG louvain websockets
JUG louvain websockets
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
Http-protocol
Http-protocolHttp-protocol
Http-protocol
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
 
HTTP Definition and Basics.
HTTP Definition and Basics.HTTP Definition and Basics.
HTTP Definition and Basics.
 
Soap vs. rest - which is right web service protocol for your need?
Soap vs. rest -  which is right web service protocol for your need?Soap vs. rest -  which is right web service protocol for your need?
Soap vs. rest - which is right web service protocol for your need?
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 
Server-Side Programming Primer
Server-Side Programming PrimerServer-Side Programming Primer
Server-Side Programming Primer
 

Similar to Decoding real time web communication

ClientServer Websocket.pptx
ClientServer Websocket.pptxClientServer Websocket.pptx
ClientServer Websocket.pptx
MaxamedSheekhAmiin
 
Taking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocketTaking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocket
Shahriar Hyder
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
Naresh Chintalcheru
 
Fight empire-html5
Fight empire-html5Fight empire-html5
Fight empire-html5
Bhakti Mehta
 
05 20254 financial stock application
05 20254 financial stock application05 20254 financial stock application
05 20254 financial stock application
IAESIJEECS
 
Esc 209 paper_doin
Esc 209 paper_doinEsc 209 paper_doin
Esc 209 paper_doin
Jonny Doin
 
What is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in ApplicationsWhat is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in Applications
Inexture Solutions
 
Websocket
WebsocketWebsocket
Websocket
艾鍗科技
 
Webbasics
WebbasicsWebbasics
Webbasics
patinijava
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
Cathie101
 
Alex carcea, radu macovei a story of how java script joined the big league
Alex carcea, radu macovei   a story of how java script joined the big leagueAlex carcea, radu macovei   a story of how java script joined the big league
Alex carcea, radu macovei a story of how java script joined the big league
Codecamp Romania
 
Dev con kolkata 2012 websockets
Dev con kolkata 2012   websocketsDev con kolkata 2012   websockets
Dev con kolkata 2012 websockets
SANKARSAN BOSE
 
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use CasesAn In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
Tien Nguyen
 
Codecamp Iasi-26 nov 2011 - Html 5 WebSockets
Codecamp Iasi-26 nov 2011 - Html 5 WebSocketsCodecamp Iasi-26 nov 2011 - Html 5 WebSockets
Codecamp Iasi-26 nov 2011 - Html 5 WebSockets
Florin Cardasim
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
Mousmi Pawar
 
Mulesoft Pune Meetup Deck - Apr 2020
Mulesoft Pune Meetup Deck - Apr 2020Mulesoft Pune Meetup Deck - Apr 2020
Mulesoft Pune Meetup Deck - Apr 2020
Santosh Ojha
 
Http2 protocol changes
Http2 protocol changesHttp2 protocol changes
Http2 protocol changes
Mark Friedman
 
21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS
koolkampus
 
Building Websocket Applications with GlassFish and Grizzly
Building Websocket Applications with GlassFish and GrizzlyBuilding Websocket Applications with GlassFish and Grizzly
Building Websocket Applications with GlassFish and Grizzly
Justin Lee
 
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
Difference between Client Polling vs Server Push vs Websocket vs Long PollingDifference between Client Polling vs Server Push vs Websocket vs Long Polling
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
jeetendra mandal
 

Similar to Decoding real time web communication (20)

ClientServer Websocket.pptx
ClientServer Websocket.pptxClientServer Websocket.pptx
ClientServer Websocket.pptx
 
Taking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocketTaking a Quantum Leap with Html 5 WebSocket
Taking a Quantum Leap with Html 5 WebSocket
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
 
Fight empire-html5
Fight empire-html5Fight empire-html5
Fight empire-html5
 
05 20254 financial stock application
05 20254 financial stock application05 20254 financial stock application
05 20254 financial stock application
 
Esc 209 paper_doin
Esc 209 paper_doinEsc 209 paper_doin
Esc 209 paper_doin
 
What is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in ApplicationsWhat is a WebSocket? Real-Time Communication in Applications
What is a WebSocket? Real-Time Communication in Applications
 
Websocket
WebsocketWebsocket
Websocket
 
Webbasics
WebbasicsWebbasics
Webbasics
 
Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
 
Alex carcea, radu macovei a story of how java script joined the big league
Alex carcea, radu macovei   a story of how java script joined the big leagueAlex carcea, radu macovei   a story of how java script joined the big league
Alex carcea, radu macovei a story of how java script joined the big league
 
Dev con kolkata 2012 websockets
Dev con kolkata 2012   websocketsDev con kolkata 2012   websockets
Dev con kolkata 2012 websockets
 
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use CasesAn In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
An In-Depth Comparison of WebSocket and SignalR: Pros, Cons, and Use Cases
 
Codecamp Iasi-26 nov 2011 - Html 5 WebSockets
Codecamp Iasi-26 nov 2011 - Html 5 WebSocketsCodecamp Iasi-26 nov 2011 - Html 5 WebSockets
Codecamp Iasi-26 nov 2011 - Html 5 WebSockets
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
 
Mulesoft Pune Meetup Deck - Apr 2020
Mulesoft Pune Meetup Deck - Apr 2020Mulesoft Pune Meetup Deck - Apr 2020
Mulesoft Pune Meetup Deck - Apr 2020
 
Http2 protocol changes
Http2 protocol changesHttp2 protocol changes
Http2 protocol changes
 
21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS21. Application Development and Administration in DBMS
21. Application Development and Administration in DBMS
 
Building Websocket Applications with GlassFish and Grizzly
Building Websocket Applications with GlassFish and GrizzlyBuilding Websocket Applications with GlassFish and Grizzly
Building Websocket Applications with GlassFish and Grizzly
 
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
Difference between Client Polling vs Server Push vs Websocket vs Long PollingDifference between Client Polling vs Server Push vs Websocket vs Long Polling
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
 

Recently uploaded

GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 

Recently uploaded (20)

GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 

Decoding real time web communication

  • 1. DECODING REAL TIME WEB AN ULTRA-COMPACT INTRO TO REAL TIME WEB TECHNOLOGIES Created by Amit Jain
  • 2. COMET Comet is a programming model that allows a web server to push data to a browser. This is often achieved through a long-held HTTP request, but there really is no standard or specification for Comet; it is just an umbrella term for all the different ways that can be used to achieve this. The different comet programming models are: Long Polling HTTP Streaming Forever-frames
  • 3. LONG POLLING With long-polling, the client sends a HTTP request, waiting for a server event. If an event occurs on the server-side, the server sends the response including the event data. After receiving the response containing the event data, the client will send a request again, waiting for the next event. There is always a pending request which allows the server to send a response at any time.
  • 4. HTTP STREAMING With Http Streaming, the server keeps the response message open. In contrast to long polling the HTTP response message (body) will not be closed after sending an event to the client. If an event occurs on the server-side, the server will write this event to the open response message body. The HTTP response message body represents a unidirectional event stream to the client.
  • 5. FOREVER-FRAMES The forever-frame technique uses HTTP 1.1 chunked encoding to establish a single, long-lived HTTP connection in a hidden iframe. Data is pushed incrementally from the server to the client over this connection, and rendered incrementally by your web browser. As events occur, the iframe is gradually filled with script tags, containing JavaScript to be executed in the browser. Because browsers render HTML pages incrementally, each script tag is executed as it is received.
  • 6. COMET AND PROXY SERVERS Long polling - provided it is implemented in a robust way, will not suffer from too many proxy server issues, because it is still just using the HTTP request and response model Streaming - is more efficient but this approach suffers from the same proxy server issues. For example, a proxy server may be buffering the response and cause latency. Alternatively, the proxy server may be configured to disconnect HTTP connections that are kept open for a certain amount of time. This is why most legacy Comet solutions simply use long-polling.
  • 7. COMET PROTOCOLS BOSCH - http://xmpp.org/extensions/xep-0124.html, bidirectional communication channel, can use HTTP streaming as well as long polling Bayeux - http://svn.cometd.org/trunk/bayeux/bayeux.html, bidirectional protocol, based on the long polling approach Uses "hacks" to break the HTTP Request-Response barrier. This forces such protocols to implement a complex session and connection management.
  • 8. HTML5 The different HTML5 programming models are: Server-Sent Events WebSockets
  • 9. SERVER-SENT EVENTS HTML5 also applies the Comet communication pattern by defining Server-Sent Events (SSE), standardizing Comet for all standards-compliant web browsers. SSE specification "defines an API for opening an HTTP connection for receiving push notifications from a server." Server-Sent Events are based on HTTP streaming. The response stays open and event data are written as they occur on the server side. Server-Sent Events includes the new HTML element EventSource as well as a new mime type text/event- stream which defines an event framing format.
  • 10. EXAMPLE CODE The EventSource represents the client-side end point to receive events. The client opens an event stream by creating an EventSource, which takes an event source URL as its constructor argument. The onmessage event handler will be called each time new data is received.
  • 11. WEBSOCKETS A bidirectional communication channel. In contrast to Server-Sent Events, the WebSocket protocol is not build on top of HTTP. However, the WebSocket protocol defines the HTTP handshake behaviour to switch an existing HTTP connection to a lower level WebSocket connection. The overhead involved managing a WebSocket is very minimal. Due the fact that WebSockets is not implemented on the top of HTTP it will not run into trouble caused by HTTP protocol limitations.
  • 12. On the other hand WebSockets, does almost nothing for reliability. It does not include reconnect handling or support guaranteed message delivery like Server-Sent Event does. Further more, as a non-HTTP based protocol, WebSocket cannot make use of the built-in reliability features of HTTP. This means reliability has to be implemented in the application (sub-protocol level) when using WebSockets.
  • 14. WEB SOCKETS AND PROXY SERVERS The problem with proxy servers for web applications that have a long-lived connection (for example, Comet HTTP streaming or HTML5 Web Sockets) is clear: HTTP proxy servers which were originally designed for document transfer — may choose to close streaming or idle WebSocket connections, because they appear to be trying to connect with an unresponsive HTTP server. Additionally, proxy servers may also buffer unencrypted HTTP responses, thereby introducing unpredictable latency during HTTP response streaming.
  • 15.
  • 16. EXAMPLE — WEBSOCKET UPGRADE HANDSHAKE
  • 17. In the case of the WebSocket upgrade request, a transparent HTTP proxy will remove the Connection: upgrade header, which will result in the WebSocket server receiving a corrupt WebSocket upgrade request. Today, most HTTP proxies are not familiar with the WebSocket protocol. Using secured WebSockets can avoid this effect. In creating a secured WebSocket connection, the browser opens an SSL connection to the WebSocket server. In this case intermediaries will not be able to interpret or modify data.
  • 18.
  • 19. If a browser is configured to use an explicit proxy server (for both encrypted and unencrypted WebSocket connections) then it will first issue an HTTP CONNECT method to that proxy server while establishing the WebSocket connection. If an unencrypted WebSocket connection (ws://) is used, then in the case of transparent proxy servers, the browser is unaware of the proxy server, so no HTTP CONNECT is sent (and so it removes upgrade headers). As a result, the connection is almost likely to fail in practice today.
  • 20. If an encrypted WebSocket Secure connection (wss://) is used, then in the case of transparent proxy servers, the browser is unaware of the proxy server, so no HTTP CONNECT is sent. However, since the wire traffic is encrypted, intermediate transparent proxy servers may simply allow the encrypted traffic through, so there is a much better chance that the WebSocket connection will succeed if an encrypted WebSocket connection is used.
  • 21. HTML5 WEB SOCKETS AND LOAD- BALANCING ROUTERS Ø TCP (Layer-4) load-balancing routers should work well with HTML5 Web Sockets, because they have the same connection profile: connect once up front and stay connected, rather than the HTTP document transfer request-response profile. Ø HTTP (Layer-7) load-balancing routers expect HTTP traffic and can easily get confused by WebSocket upgrade traffic. For that reason, Layer 7 load balancing routers may need to be configured to be explicitly aware of WebSocket traffic.
  • 22. HTML5 WEB SOCKETS AND FIREWALLS Since firewalls normally just enforce the rules for inbound traffic rejection and outbound traffic routing (for example, through the proxy server), there are usually no specific WebSocket traffic-related firewall concerns.
  • 23. SSE VS WEB SOCKETS SSE Web Sockets Unidirectional server-to-client channel only Full-duplex, bidirectional communication (not just server push) Runs on top of HTTP (uses HTTP streaming) Highly efficient: minimal overhead involved in managing a WebSocket, runs on top of TCP so no HTTP hacks
  • 24. SSE Web Sockets Includes powerful features to reconnect and synchronize messages Does not include reconnect handling or guarantee message delivery High reliability is a built- in feature No built-in reliability. This has to be done on the application (sub-protocol) level Not supported by IE Supported by IE
  • 26. Q&A