SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

Web Services 2009
Web Services 2009Web Services 2009
Web Services 2009
Cathie101
 
HTTP Definition and Basics.
HTTP Definition and Basics.HTTP Definition and Basics.
HTTP Definition and Basics.
Halah Salih
 

Mais procurados (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
 

Semelhante a Decoding real time web communication

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
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
Mousmi Pawar
 
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
 

Semelhante a 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
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

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