SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
HTML5 - WebSockets
                          T-111.5502 Seminar on Media Technology
                                     Harri Hämäläinen
                                  harri hamalainen aalto fi




Tuesday, October 25, 11
Web communications
                           before WebSockets
                     •    HTTP protocol is based on request-response paradigm
                          -   In HTTP/0.9 and HTTP/1.0 the connection is closed after the
                              response is received
                          -   In HTTP/1.1 the persistent connection was introduced which
                              allows client to make multiple requests over the same
                              underlying TCP session
                     •    Web 2.0 needed real-time communication i.e. low latency, full-
                          duplex connections
                          -   Games, instant messaging, collaboration platforms
                     •    Various “solutions” used
                          -   AJAX, Comets, hackshacks...


                                                        2
Tuesday, October 25, 11
Polling
       • Client issues new HTTP
       requests with some interval
       • Server must respond even if no
       new data is available              Client                   Server
                                                                        Data available
                                                   HTTP Request

        - Header overhead                          HTTP Response



       • Defining the interval requires                                  Data available
                                                                        Data available

       heuristics
       • Latency issues
        - Server must wait new requests
        even if new data is already
        available



                                      3
Tuesday, October 25, 11
Long polling
       • Server holds requests until an
       event occurs (data becomes
       available, timeout, ...)                                        Server

       • Client issues new requests
                                              Client
                                                       HTTP Request             Data available



       immediately when old ones are
                                                       HTTP Response



       responded                                                                   Timeout


       • Each request still needs HTTP
       headers resent
                                                                                Data available
                                                                                Data available




                                          4
Tuesday, October 25, 11
HTTP Streaming
       • Uses HTTP/1.1 persistent
       connection feature
       • Server sends new data as
       partial responds
                                                        Server
                                               Client



       • Several intermediaries might
                                                                 Data available




       cause problems for real-time
       communication as traffic is                                Data available


       traditional HTTP                                          Data available


        - proxies, caches, gateways
       • Still timeouts and need for new
       connections



                                           5
Tuesday, October 25, 11
WebSocket
                     •    Real-time, full-duplex communication
                     •    Builds on top of HTTP
                          -   Can share ports with basic HTTP(s)
                          -   HTTP session is Upgraded to WebSocket
                     •    URL Scheme uses ws:// and wss:// analogous to http:// and https://
                     •    Messages are either UTF-8 text or binary data, no theoretical
                          maximum for message length
                     •    Only small overhead for text messages (frames) after handshake:
                          -   0x00 for frame start, 0xFF for frame end (compared to
                              traditional HTTP handshake ~ 1K bytes)


                                                       6
Tuesday, October 25, 11
http://html5.org/tools/web-apps-tracker   7
Tuesday, October 25, 11
WebSocket handshake
                Client requests connection upgrade
                          GET /chat HTTP/1.1
                          Host: server.example.com
                          Upgrade: websocket
                          Connection: Upgrade
                          Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
                          Origin: http://example.com
                          Sec-WebSocket-Protocol: chat, superchat
                          Sec-WebSocket-Version: 13




                Server responds
                          HTTP/1.1 101 Switching Protocols
                          Upgrade: websocket
                          Connection: Upgrade
                          Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
                          Sec-WebSocket-Protocol: chat




                                                           8
Tuesday, October 25, 11
WebSocket API




                                9
Tuesday, October 25, 11
WebSocket Security

                     • Old protocol versions (hixie-75, hixie-76 /
                          hybi-00) susceptible for cache poisoning
                          attacks due to transparent proxies [a]
                     • Protocol allows origin policies
                          a: Huang; Lin-Shung, et al., Talking Yourself for Fun and Profit


                                                                            10
Tuesday, October 25, 11
WebSockets in use
                     •     Unified way to real-time full-duplex communication
                          - http://socket.io
                     •     P2P communication
                          - http://browsersocket.org
                          - Morris-Pearse, Michael.; A Secure P2P Server in the Web Browser
                     •     Online games, visualization
                          - Chen, B. (2011). A Framework for Browser-based Multiplayer Online Games using
                              WebGL and WebSocket. Architecture

                          -   Wessels, A., Purvis, M., Jackson, J., & Rahman, S. (Shawon). (2011). Remote Data
                              Visualization through WebSockets



                                                                  11
Tuesday, October 25, 11
References
                     •    Loreto, et al., Bidirectional HTTP, Oct 2009
                     •    Huang; Lin-Shung, et al., Talking Yourself for Fun and Profit
                     •    Hickson; Ian,The WebSocket API, http://dev.w3.org/html5/
                          websockets/
                     •    HTML 5 Revision Tracker, http://html5.org/tools/web-apps-tracker
                     •    Morris-Pearse, Michael.; A Secure P2P Server in the Web Browser
                     •    Chen, B. (2011). A Framework for Browser-based Multiplayer
                          Online Games using WebGL and WebSocket. Architecture
                     •    Wessels, A., Purvis, M., Jackson, J., & Rahman, S. (Shawon). (2011).
                          Remote Data Visualization through WebSockets


                                                         12
Tuesday, October 25, 11
Demo
                          http://localhost:8888/




                                    13
Tuesday, October 25, 11

Weitere ähnliche Inhalte

Was ist angesagt?

vlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets Presentationvlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets PresentationVolodymyr Lavrynovych
 
Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015
Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015
Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015Rich Cullen
 
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoTWebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoTFrank Greco
 
Pushing the web — WebSockets
Pushing the web — WebSocketsPushing the web — WebSockets
Pushing the web — WebSocketsRoland M
 
Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014Frank Greco
 
Real Life WebSocket Case Studies and Demos
Real Life WebSocket Case Studies and DemosReal Life WebSocket Case Studies and Demos
Real Life WebSocket Case Studies and DemosPeter Moskovits
 
Websocket protocol overview
Websocket protocol overviewWebsocket protocol overview
Websocket protocol overviewallenmeng
 
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...Peter Moskovits
 
HTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the WebHTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the WebPeter Lubbers
 
WebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureWebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureFrank Greco
 
Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossugclkao
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketbrent bucci
 
Jetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerJetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerCodemotion
 

Was ist angesagt? (20)

vlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets Presentationvlavrynovych - WebSockets Presentation
vlavrynovych - WebSockets Presentation
 
Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015
Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015
Top 10 real life WebSocket use cases & experiences - Devoxx UK 2015
 
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoTWebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
 
Pushing the web — WebSockets
Pushing the web — WebSocketsPushing the web — WebSockets
Pushing the web — WebSockets
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014Past, Present and Future of WebSocket - HTML5DevConf May 2014
Past, Present and Future of WebSocket - HTML5DevConf May 2014
 
Real Life WebSocket Case Studies and Demos
Real Life WebSocket Case Studies and DemosReal Life WebSocket Case Studies and Demos
Real Life WebSocket Case Studies and Demos
 
Websocket protocol overview
Websocket protocol overviewWebsocket protocol overview
Websocket protocol overview
 
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
JMS, WebSocket, and the Internet of Things - Controlling Physical Devices on ...
 
HTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the WebHTML5 WebSocket: The New Network Stack for the Web
HTML5 WebSocket: The New Network Stack for the Web
 
Kaazing
KaazingKaazing
Kaazing
 
WebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureWebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the Future
 
Websockets at tossug
Websockets at tossugWebsockets at tossug
Websockets at tossug
 
Intro to WebSockets
Intro to WebSocketsIntro to WebSockets
Intro to WebSockets
 
Php push notifications
Php push notificationsPhp push notifications
Php push notifications
 
Grizzly 20080925 V2
Grizzly 20080925 V2Grizzly 20080925 V2
Grizzly 20080925 V2
 
V2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocketV2 peter-lubbers-sf-jug-websocket
V2 peter-lubbers-sf-jug-websocket
 
HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
Jetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet ContainerJetty 9 – The Next Generation Servlet Container
Jetty 9 – The Next Generation Servlet Container
 
HTML5 ADEO
HTML5 ADEOHTML5 ADEO
HTML5 ADEO
 

Ähnlich wie HTML5 WebSockets

Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networkingukdpe
 
INFT132 093 03 Web Concepts
INFT132 093 03 Web ConceptsINFT132 093 03 Web Concepts
INFT132 093 03 Web ConceptsMichael Rees
 
Comet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forwardComet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forwardNOLOH LLC.
 
Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15streamdata.io
 
JUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at Scale
JUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at ScaleJUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at Scale
JUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at ScaleC2B2 Consulting
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptxssuseraf60311
 
Using Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 WorldUsing Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 WorldGil Fink
 
Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"Sachin Katariya
 
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCamelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCharles Moulliard
 
www | HTTP | HTML - Tutorial
www | HTTP | HTML - Tutorialwww | HTTP | HTML - Tutorial
www | HTTP | HTML - TutorialMSA Technosoft
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...Edward Burns
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocolsDaniel Austin
 
Top 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersTop 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersBrian Huff
 
Computer network (10)
Computer network (10)Computer network (10)
Computer network (10)NYversity
 

Ähnlich wie HTML5 WebSockets (20)

Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networking
 
INFT132 093 03 Web Concepts
INFT132 093 03 Web ConceptsINFT132 093 03 Web Concepts
INFT132 093 03 Web Concepts
 
Comet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forwardComet: by pushing server data, we push the web forward
Comet: by pushing server data, we push the web forward
 
Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15Websocket vs SSE - Paris.js - 24/06/15
Websocket vs SSE - Paris.js - 24/06/15
 
JUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at Scale
JUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at ScaleJUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at Scale
JUDCon 2013- JBoss Data Grid and WebSockets: Delivering Real Time Push at Scale
 
computer networking
computer networkingcomputer networking
computer networking
 
Http protocol
Http protocolHttp protocol
Http protocol
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptx
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
Using Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 WorldUsing Communication and Messaging API in the HTML5 World
Using Communication and Messaging API in the HTML5 World
 
Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"Webinar slides "Building Real-Time Collaborative Web Applications"
Webinar slides "Building Real-Time Collaborative Web Applications"
 
Building real-time-collaborative-web-applications
Building real-time-collaborative-web-applicationsBuilding real-time-collaborative-web-applications
Building real-time-collaborative-web-applications
 
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCamelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
 
www | HTTP | HTML - Tutorial
www | HTTP | HTML - Tutorialwww | HTTP | HTML - Tutorial
www | HTTP | HTML - Tutorial
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
 
Next generation web protocols
Next generation web protocolsNext generation web protocols
Next generation web protocols
 
HTTP/2
HTTP/2HTTP/2
HTTP/2
 
Top 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud DevelopersTop 10 HTML5 Features for Oracle Cloud Developers
Top 10 HTML5 Features for Oracle Cloud Developers
 
Computer network (10)
Computer network (10)Computer network (10)
Computer network (10)
 
Hypertext Transfer Protocol
Hypertext Transfer ProtocolHypertext Transfer Protocol
Hypertext Transfer Protocol
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
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...DianaGray10
 
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 FresherRemote DBA Services
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
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 FMESafe Software
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
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 DiscoveryTrustArc
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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...
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
+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...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 

HTML5 WebSockets

  • 1. HTML5 - WebSockets T-111.5502 Seminar on Media Technology Harri Hämäläinen harri hamalainen aalto fi Tuesday, October 25, 11
  • 2. Web communications before WebSockets • HTTP protocol is based on request-response paradigm - In HTTP/0.9 and HTTP/1.0 the connection is closed after the response is received - In HTTP/1.1 the persistent connection was introduced which allows client to make multiple requests over the same underlying TCP session • Web 2.0 needed real-time communication i.e. low latency, full- duplex connections - Games, instant messaging, collaboration platforms • Various “solutions” used - AJAX, Comets, hackshacks... 2 Tuesday, October 25, 11
  • 3. Polling • Client issues new HTTP requests with some interval • Server must respond even if no new data is available Client Server Data available HTTP Request - Header overhead HTTP Response • Defining the interval requires Data available Data available heuristics • Latency issues - Server must wait new requests even if new data is already available 3 Tuesday, October 25, 11
  • 4. Long polling • Server holds requests until an event occurs (data becomes available, timeout, ...) Server • Client issues new requests Client HTTP Request Data available immediately when old ones are HTTP Response responded Timeout • Each request still needs HTTP headers resent Data available Data available 4 Tuesday, October 25, 11
  • 5. HTTP Streaming • Uses HTTP/1.1 persistent connection feature • Server sends new data as partial responds Server Client • Several intermediaries might Data available cause problems for real-time communication as traffic is Data available traditional HTTP Data available - proxies, caches, gateways • Still timeouts and need for new connections 5 Tuesday, October 25, 11
  • 6. WebSocket • Real-time, full-duplex communication • Builds on top of HTTP - Can share ports with basic HTTP(s) - HTTP session is Upgraded to WebSocket • URL Scheme uses ws:// and wss:// analogous to http:// and https:// • Messages are either UTF-8 text or binary data, no theoretical maximum for message length • Only small overhead for text messages (frames) after handshake: - 0x00 for frame start, 0xFF for frame end (compared to traditional HTTP handshake ~ 1K bytes) 6 Tuesday, October 25, 11
  • 7. http://html5.org/tools/web-apps-tracker 7 Tuesday, October 25, 11
  • 8. WebSocket handshake Client requests connection upgrade GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 Server responds HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat 8 Tuesday, October 25, 11
  • 9. WebSocket API 9 Tuesday, October 25, 11
  • 10. WebSocket Security • Old protocol versions (hixie-75, hixie-76 / hybi-00) susceptible for cache poisoning attacks due to transparent proxies [a] • Protocol allows origin policies a: Huang; Lin-Shung, et al., Talking Yourself for Fun and Profit 10 Tuesday, October 25, 11
  • 11. WebSockets in use • Unified way to real-time full-duplex communication - http://socket.io • P2P communication - http://browsersocket.org - Morris-Pearse, Michael.; A Secure P2P Server in the Web Browser • Online games, visualization - Chen, B. (2011). A Framework for Browser-based Multiplayer Online Games using WebGL and WebSocket. Architecture - Wessels, A., Purvis, M., Jackson, J., & Rahman, S. (Shawon). (2011). Remote Data Visualization through WebSockets 11 Tuesday, October 25, 11
  • 12. References • Loreto, et al., Bidirectional HTTP, Oct 2009 • Huang; Lin-Shung, et al., Talking Yourself for Fun and Profit • Hickson; Ian,The WebSocket API, http://dev.w3.org/html5/ websockets/ • HTML 5 Revision Tracker, http://html5.org/tools/web-apps-tracker • Morris-Pearse, Michael.; A Secure P2P Server in the Web Browser • Chen, B. (2011). A Framework for Browser-based Multiplayer Online Games using WebGL and WebSocket. Architecture • Wessels, A., Purvis, M., Jackson, J., & Rahman, S. (Shawon). (2011). Remote Data Visualization through WebSockets 12 Tuesday, October 25, 11
  • 13. Demo http://localhost:8888/ 13 Tuesday, October 25, 11