SlideShare ist ein Scribd-Unternehmen logo
1 von 32
WebSockets Everywhere: the Future
Transport Protocol for Everything
(Almost)
Dan Shappir
CTO at Ericom Software
@DanShappir
blog: ericomguy.blogspot.com
Six-time BriForum speaker
Remember DCOM?
● Microsoft Distributed COM, circa 1996
● General purpose communication layer for
client / server
● UDP-based, using ports 1024-5000
● COM succeeded; DCOM failed
Can you guess why?
Network Security Realities
● Firewalls/proxies dislike UDP
● Firewalls/proxies often dislike TCP
● Firewalls/proxies like HTTP (80) and HTTPS
(443)
o But dislike most any other port
Stateful Inspection means that just tunneling
through ports 80 and 443 isn’t enough
Make Apps Look Like Websites
Use HTTP / HTTPS as an applicative transport
Example: RD Gateway (tunnels RDP through HTTPS)
● Web Services
● XML and SOAP
● RESTful APIs
● JSON
● AJAX
HTTP Was Designed For Docs Not Apps
● Built on TCP Sockets but ...
● Request / Response architecture
o Only client can send Requests
o Server can only Respond to Requests
o Can’t send another Request before Response
● Header on every Request / Response
o Up to 8KB each
Various Workarounds
COMET
● Persistent connections (HTTP 1.1)
● Polling
● Long Polling
● Chunked Response
● Multiple channels
● Pipelining
● Two-way HTTP
Problems With Workarounds
● Hacks: error prone
● Complicated
● Compatibility issues
● Headers overhead
o Especially if contains cookies
Need a Better Solution
Flexibility of Sockets + reach of Web (HTTP)
WebSockets - Sockets for the Web
● Part of HTML5: W3C API and IETF Protocol
● Full-duplex, bidirectional communication
● Unsecured (TCP) and secured (SSL) modes
● Traverses firewalls, proxies and routers
● Text (UTF-8) and binary data
● Ping/Pong messages for keep-alive
● Share ports 80 and 443 with HTTP/HTTPS
WebSocket Connection Process
1. Client opens new TCP connection to Server
2. Optional SSL (TLS) handshake
3. Client sends HTTP GET Request
4. Server sends HTTP Response
5. Magic: Client & Server communicate using
WebSocket packets
WebSocket Request
GET /blaze HTTP/1.1
Host: an.ericom.com
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw==
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol: ericom|accessnow.3
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits,
x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
Origin: http://127.0.0.1
WebSocket Request
GET /blaze HTTP/1.1
Host: an.ericom.com
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw==
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol: ericom|accessnow.3
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits,
x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
Origin: http://127.0.0.1
WebSocket Request
GET /blaze HTTP/1.1
Host: an.ericom.com
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw==
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol: ericom|accessnow.3
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits,
x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
Origin: http://127.0.0.1
WebSocket Request
GET /blaze HTTP/1.1
Host: an.ericom.com
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw==
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol: ericom|accessnow.3
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits,
x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36
Origin: http://127.0.0.1
WebSocket Response
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Accept:kgTM0bjagqwcNTJaj/VZZZZCJ5Q=
Sec-WebSocket-Protocol:ericom|accessnow.3
WebSocket Response
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Accept:kgTM0bjagqwcNTJaj/VZZZZCJ5Q=
Sec-WebSocket-Protocol:ericom|accessnow.3
WebSocket Response
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Accept:kgTM0bjagqwcNTJaj/VZZZZCJ5Q=
Sec-WebSocket-Protocol:ericom|accessnow.3
WebSocket Response
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Accept: kgTM0bjagqwcNTJaj/VZZZZCJ5Q=
Sec-WebSocket-Protocol: ericom|accessnow.3
Packet Oriented Protocol
● After handshake, protocol is sequence of
packets
● Packets comprised of header + payload
● Several packet types
● Peers receive full data packets payload
o Not partial packets / bytes
o Not control packets
WebSocket Packet
Minimally framed: small header + payload
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
F
I
N
R
S
V
1
R
S
V
2
R
S
V
3
opcode(4)
M
A
S
K
payload
len(7)
extended payload len(16/64)
extended payload len continued(16/64)
masking key(0/32)
masking key continued payload ...
Packet Opcodes (Types)
0 - continuation frame
1 - text frame (UTF-8)
2 - binary frame
3-7 - reserved (data)
8 - connection close
9 - ping
10 - pong
11-15 - reserved (control)
WebSockets vs HTTP Bandwidth
Simple JavaScript Example
var ws = new WebSocket("ws://...");
ws.onopen = function () {
ws.send("hello");
};
ws.onmessage = function (event) {
console.log(event.data);
};
Growing Support
● Browsers
o Everybody!
● Webservers
o Most everybody!
● Firewalls
o Often just works
● SSL VPN
o Juniper, Cisco, CheckPoint, …
Benefits of SSL VPNs over VPNs
For Web protocols: HTTP and WebSockets
● No client-side installation
● No client-side configuration
● Any client device
WebSockets For Native Apps
● .NET (4.5) WCF support
● Java EE (JSR-356)
● C/C++ - several Open Source implementations
● PHP - Rachet
● Node.js - multiple libraries
WebSockets Extensions
Utilizing Sec-WebSocket-Extensions in
Request/Response Headers:
1. Compression (deflate)
2. Multiplexing
What If It Doesn’t Connect?
● Use standard ports: 80, 443
o Or standard alternate ports: 8080, 8443, 8008
● Use SSL, with proper certificates
● Upgrade SSL VPN, Firewall, …
● Disable anti-virus
o Or exception, or disable packet inspection
● Fallback to HTTP / HTTPS
Future Protocol For Everything?
No, primarily when UDP is required
● Streaming Video or Video Conferencing
● Remote access over bad connections
(“Framehawk” scenario)
The Future, Future Protocol
● For UDP: WebRTC with data-channels
o Use WebSockets as fallback
● For TCP: WebSockets
o Use HTTP / HTTPS as fallback
● HTTP / HTTPS for RESTful APIs
Summary
WebSockets couple the performance and
flexibility of TCP with the reach of HTTP
Prediction: WebSockets will replace simple
TCP as preferred underlying protocol
Existing protocols wrapped in WebSockets

Weitere ähnliche Inhalte

Was ist angesagt?

Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaJames Falkner
 
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 WebsocketsNaresh Chintalcheru
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with CometSimon Willison
 
Using WebSockets with ColdFusion
Using WebSockets with ColdFusionUsing WebSockets with ColdFusion
Using WebSockets with ColdFusioncfjedimaster
 
LCA2014 - Introduction to Go
LCA2014 - Introduction to GoLCA2014 - Introduction to Go
LCA2014 - Introduction to Godreamwidth
 
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
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSocketsGunnar Hillert
 
Real-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisReal-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisYork Tsai
 
Cowboy rabbit-websockets
Cowboy rabbit-websocketsCowboy rabbit-websockets
Cowboy rabbit-websocketsWade Mealing
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with javaJeongHun Byeon
 
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCamelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCharles Moulliard
 
Smart Gamma - Real-Time Web applications with PHP and Websocket.
Smart Gamma - Real-Time Web applications with PHP and Websocket.Smart Gamma - Real-Time Web applications with PHP and Websocket.
Smart Gamma - Real-Time Web applications with PHP and Websocket.Evgeniy Kuzmin
 

Was ist angesagt? (20)

Asynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and JavaAsynchronous Web Programming with HTML5 WebSockets and Java
Asynchronous Web Programming with HTML5 WebSockets and Java
 
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
 
Intro to WebSockets
Intro to WebSocketsIntro to WebSockets
Intro to WebSockets
 
WebSockets and Java
WebSockets and JavaWebSockets and Java
WebSockets and Java
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
Going Live! with Comet
Going Live! with CometGoing Live! with Comet
Going Live! with Comet
 
Time for Comet?
Time for Comet?Time for Comet?
Time for Comet?
 
Using WebSockets with ColdFusion
Using WebSockets with ColdFusionUsing WebSockets with ColdFusion
Using WebSockets with ColdFusion
 
Ws
WsWs
Ws
 
Websockets and SockJS, Real time chatting
Websockets and SockJS, Real time chattingWebsockets and SockJS, Real time chatting
Websockets and SockJS, Real time chatting
 
LCA2014 - Introduction to Go
LCA2014 - Introduction to GoLCA2014 - Introduction to Go
LCA2014 - Introduction to Go
 
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
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 
Websocket 101 in Python
Websocket 101 in PythonWebsocket 101 in Python
Websocket 101 in Python
 
Real-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and RedisReal-time Web Application with Socket.IO, Node.js, and Redis
Real-time Web Application with Socket.IO, Node.js, and Redis
 
Cowboy rabbit-websockets
Cowboy rabbit-websocketsCowboy rabbit-websockets
Cowboy rabbit-websockets
 
J web socket
J web socketJ web socket
J web socket
 
Realtime web application with java
Realtime web application with javaRealtime web application with java
Realtime web application with java
 
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/CamelCamelone-2012 HTML5 WebSocket ActiveMQ/Camel
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
 
Smart Gamma - Real-Time Web applications with PHP and Websocket.
Smart Gamma - Real-Time Web applications with PHP and Websocket.Smart Gamma - Real-Time Web applications with PHP and Websocket.
Smart Gamma - Real-Time Web applications with PHP and Websocket.
 

Andere mochten auch

WWC Orientation presentation
WWC Orientation presentationWWC Orientation presentation
WWC Orientation presentationEmilyDShaw
 
Healthcare in the age of mobile working - with Ericom
Healthcare in the age of mobile working - with EricomHealthcare in the age of mobile working - with Ericom
Healthcare in the age of mobile working - with EricomEricom Software
 
Gender.AI Natural Language AI Startup that didn't get funded in 2015.
Gender.AI Natural Language AI Startup that didn't get funded in 2015.Gender.AI Natural Language AI Startup that didn't get funded in 2015.
Gender.AI Natural Language AI Startup that didn't get funded in 2015.Tony Marks
 
"Applications of Finger millet in Dairy and Food Industry" - SANTHOSH.V.N ...
"Applications of  Finger millet in Dairy and Food Industry" - SANTHOSH.V.N  ..."Applications of  Finger millet in Dairy and Food Industry" - SANTHOSH.V.N  ...
"Applications of Finger millet in Dairy and Food Industry" - SANTHOSH.V.N ...Santhosh V N
 
Intro lecture: Theory and method for media technology
Intro lecture: Theory and method for media technologyIntro lecture: Theory and method for media technology
Intro lecture: Theory and method for media technologyhrastinski
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)Peter Lubbers
 
Adithya Frondoso
Adithya FrondosoAdithya Frondoso
Adithya Frondosoadithi341
 
De an-tuyen-sinh-dh-phuong-dong-2015
De an-tuyen-sinh-dh-phuong-dong-2015De an-tuyen-sinh-dh-phuong-dong-2015
De an-tuyen-sinh-dh-phuong-dong-2015giaoduc0123
 
Adithya Frondoso Bangalore
Adithya Frondoso BangaloreAdithya Frondoso Bangalore
Adithya Frondoso Bangaloreadithi341
 
Phuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duong
Phuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duongPhuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duong
Phuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duonggiaoduc0123
 
De an-tuyen-sinh-truong-dh-tien-giang
De an-tuyen-sinh-truong-dh-tien-giangDe an-tuyen-sinh-truong-dh-tien-giang
De an-tuyen-sinh-truong-dh-tien-gianggiaoduc0123
 
Thông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí Minh
Thông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí MinhThông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí Minh
Thông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí Minhgiaoduc0123
 
Adithya Frondoso Location
Adithya Frondoso LocationAdithya Frondoso Location
Adithya Frondoso Locationadithi341
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSocketsWASdev Community
 

Andere mochten auch (17)

LBSDRC News
LBSDRC NewsLBSDRC News
LBSDRC News
 
WWC Orientation presentation
WWC Orientation presentationWWC Orientation presentation
WWC Orientation presentation
 
Healthcare in the age of mobile working - with Ericom
Healthcare in the age of mobile working - with EricomHealthcare in the age of mobile working - with Ericom
Healthcare in the age of mobile working - with Ericom
 
Gender.AI Natural Language AI Startup that didn't get funded in 2015.
Gender.AI Natural Language AI Startup that didn't get funded in 2015.Gender.AI Natural Language AI Startup that didn't get funded in 2015.
Gender.AI Natural Language AI Startup that didn't get funded in 2015.
 
"Applications of Finger millet in Dairy and Food Industry" - SANTHOSH.V.N ...
"Applications of  Finger millet in Dairy and Food Industry" - SANTHOSH.V.N  ..."Applications of  Finger millet in Dairy and Food Industry" - SANTHOSH.V.N  ...
"Applications of Finger millet in Dairy and Food Industry" - SANTHOSH.V.N ...
 
African (1)
African (1)African (1)
African (1)
 
Intro lecture: Theory and method for media technology
Intro lecture: Theory and method for media technologyIntro lecture: Theory and method for media technology
Intro lecture: Theory and method for media technology
 
WebSocket protocol
WebSocket protocolWebSocket protocol
WebSocket protocol
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
 
Adithya Frondoso
Adithya FrondosoAdithya Frondoso
Adithya Frondoso
 
De an-tuyen-sinh-dh-phuong-dong-2015
De an-tuyen-sinh-dh-phuong-dong-2015De an-tuyen-sinh-dh-phuong-dong-2015
De an-tuyen-sinh-dh-phuong-dong-2015
 
Adithya Frondoso Bangalore
Adithya Frondoso BangaloreAdithya Frondoso Bangalore
Adithya Frondoso Bangalore
 
Phuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duong
Phuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duongPhuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duong
Phuong thuc-tuyen-sinh-rieng-cua-truong-dh-binh-duong
 
De an-tuyen-sinh-truong-dh-tien-giang
De an-tuyen-sinh-truong-dh-tien-giangDe an-tuyen-sinh-truong-dh-tien-giang
De an-tuyen-sinh-truong-dh-tien-giang
 
Thông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí Minh
Thông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí MinhThông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí Minh
Thông tin tuyển sinh các trường ĐH-CĐ Thành phố Hồ Chí Minh
 
Adithya Frondoso Location
Adithya Frondoso LocationAdithya Frondoso Location
Adithya Frondoso Location
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 

Ähnlich wie WebSockets Everywhere: the Future Transport Protocol

Websocket technology for XPages
Websocket technology for XPagesWebsocket technology for XPages
Websocket technology for XPagesCsaba Kiss
 
Primer to Browser Netwroking
Primer to Browser NetwrokingPrimer to Browser Netwroking
Primer to Browser NetwrokingShuya Osaki
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On FireJef Claes
 
Java Networking
Java NetworkingJava Networking
Java NetworkingSunil OS
 
Comet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumComet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumJoe Walker
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5Eyal Vardi
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagarNitish Nagar
 
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebCleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebSteffen Gebert
 
HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014Christian Wenz
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websocketsWim Godden
 
My adventure with WebSockets
My adventure with WebSocketsMy adventure with WebSockets
My adventure with WebSocketsMichiel De Mey
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in JavaTushar B Kute
 
Training Webinar: Enterprise application performance with server push technol...
Training Webinar: Enterprise application performance with server push technol...Training Webinar: Enterprise application performance with server push technol...
Training Webinar: Enterprise application performance with server push technol...OutSystems
 
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 WebSocketShahriar Hyder
 

Ähnlich wie WebSockets Everywhere: the Future Transport Protocol (20)

Websocket technology for XPages
Websocket technology for XPagesWebsocket technology for XPages
Websocket technology for XPages
 
DevCon 5 (July 2013) - WebSockets
DevCon 5 (July 2013) - WebSocketsDevCon 5 (July 2013) - WebSockets
DevCon 5 (July 2013) - WebSockets
 
Primer to Browser Netwroking
Primer to Browser NetwrokingPrimer to Browser Netwroking
Primer to Browser Netwroking
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On Fire
 
The HTML5 WebSocket API
The HTML5 WebSocket APIThe HTML5 WebSocket API
The HTML5 WebSocket API
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Websocket
WebsocketWebsocket
Websocket
 
Comet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way MediumComet: Making The Web a 2-Way Medium
Comet: Making The Web a 2-Way Medium
 
DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5DEV301- Web Service Programming with WCF 3.5
DEV301- Web Service Programming with WCF 3.5
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagar
 
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebCleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
 
HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014HTML5/JavaScript Communication APIs - DPC 2014
HTML5/JavaScript Communication APIs - DPC 2014
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
My adventure with WebSockets
My adventure with WebSocketsMy adventure with WebSockets
My adventure with WebSockets
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
 
Cgi
CgiCgi
Cgi
 
introduction to web application development
introduction to web application developmentintroduction to web application development
introduction to web application development
 
Training Webinar: Enterprise application performance with server push technol...
Training Webinar: Enterprise application performance with server push technol...Training Webinar: Enterprise application performance with server push technol...
Training Webinar: Enterprise application performance with server push technol...
 
Websocket
WebsocketWebsocket
Websocket
 
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
 

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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

WebSockets Everywhere: the Future Transport Protocol

  • 1. WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)
  • 2. Dan Shappir CTO at Ericom Software @DanShappir blog: ericomguy.blogspot.com Six-time BriForum speaker
  • 3. Remember DCOM? ● Microsoft Distributed COM, circa 1996 ● General purpose communication layer for client / server ● UDP-based, using ports 1024-5000 ● COM succeeded; DCOM failed Can you guess why?
  • 4. Network Security Realities ● Firewalls/proxies dislike UDP ● Firewalls/proxies often dislike TCP ● Firewalls/proxies like HTTP (80) and HTTPS (443) o But dislike most any other port Stateful Inspection means that just tunneling through ports 80 and 443 isn’t enough
  • 5. Make Apps Look Like Websites Use HTTP / HTTPS as an applicative transport Example: RD Gateway (tunnels RDP through HTTPS) ● Web Services ● XML and SOAP ● RESTful APIs ● JSON ● AJAX
  • 6. HTTP Was Designed For Docs Not Apps ● Built on TCP Sockets but ... ● Request / Response architecture o Only client can send Requests o Server can only Respond to Requests o Can’t send another Request before Response ● Header on every Request / Response o Up to 8KB each
  • 7. Various Workarounds COMET ● Persistent connections (HTTP 1.1) ● Polling ● Long Polling ● Chunked Response ● Multiple channels ● Pipelining ● Two-way HTTP
  • 8. Problems With Workarounds ● Hacks: error prone ● Complicated ● Compatibility issues ● Headers overhead o Especially if contains cookies
  • 9. Need a Better Solution Flexibility of Sockets + reach of Web (HTTP)
  • 10. WebSockets - Sockets for the Web ● Part of HTML5: W3C API and IETF Protocol ● Full-duplex, bidirectional communication ● Unsecured (TCP) and secured (SSL) modes ● Traverses firewalls, proxies and routers ● Text (UTF-8) and binary data ● Ping/Pong messages for keep-alive ● Share ports 80 and 443 with HTTP/HTTPS
  • 11. WebSocket Connection Process 1. Client opens new TCP connection to Server 2. Optional SSL (TLS) handshake 3. Client sends HTTP GET Request 4. Server sends HTTP Response 5. Magic: Client & Server communicate using WebSocket packets
  • 12. WebSocket Request GET /blaze HTTP/1.1 Host: an.ericom.com Connection: Upgrade Upgrade: websocket Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw== Sec-WebSocket-Version: 13 Sec-WebSocket-Protocol: ericom|accessnow.3 Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 Origin: http://127.0.0.1
  • 13. WebSocket Request GET /blaze HTTP/1.1 Host: an.ericom.com Connection: Upgrade Upgrade: websocket Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw== Sec-WebSocket-Version: 13 Sec-WebSocket-Protocol: ericom|accessnow.3 Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 Origin: http://127.0.0.1
  • 14. WebSocket Request GET /blaze HTTP/1.1 Host: an.ericom.com Connection: Upgrade Upgrade: websocket Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw== Sec-WebSocket-Version: 13 Sec-WebSocket-Protocol: ericom|accessnow.3 Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 Origin: http://127.0.0.1
  • 15. WebSocket Request GET /blaze HTTP/1.1 Host: an.ericom.com Connection: Upgrade Upgrade: websocket Sec-WebSocket-Key: oY+dTudispTU+nqsq5XXVw== Sec-WebSocket-Version: 13 Sec-WebSocket-Protocol: ericom|accessnow.3 Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 Origin: http://127.0.0.1
  • 16. WebSocket Response HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade: websocket Sec-WebSocket-Accept:kgTM0bjagqwcNTJaj/VZZZZCJ5Q= Sec-WebSocket-Protocol:ericom|accessnow.3
  • 17. WebSocket Response HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade: websocket Sec-WebSocket-Accept:kgTM0bjagqwcNTJaj/VZZZZCJ5Q= Sec-WebSocket-Protocol:ericom|accessnow.3
  • 18. WebSocket Response HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade: websocket Sec-WebSocket-Accept:kgTM0bjagqwcNTJaj/VZZZZCJ5Q= Sec-WebSocket-Protocol:ericom|accessnow.3
  • 19. WebSocket Response HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade: websocket Sec-WebSocket-Accept: kgTM0bjagqwcNTJaj/VZZZZCJ5Q= Sec-WebSocket-Protocol: ericom|accessnow.3
  • 20. Packet Oriented Protocol ● After handshake, protocol is sequence of packets ● Packets comprised of header + payload ● Several packet types ● Peers receive full data packets payload o Not partial packets / bytes o Not control packets
  • 21. WebSocket Packet Minimally framed: small header + payload 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 F I N R S V 1 R S V 2 R S V 3 opcode(4) M A S K payload len(7) extended payload len(16/64) extended payload len continued(16/64) masking key(0/32) masking key continued payload ...
  • 22. Packet Opcodes (Types) 0 - continuation frame 1 - text frame (UTF-8) 2 - binary frame 3-7 - reserved (data) 8 - connection close 9 - ping 10 - pong 11-15 - reserved (control)
  • 23. WebSockets vs HTTP Bandwidth
  • 24. Simple JavaScript Example var ws = new WebSocket("ws://..."); ws.onopen = function () { ws.send("hello"); }; ws.onmessage = function (event) { console.log(event.data); };
  • 25. Growing Support ● Browsers o Everybody! ● Webservers o Most everybody! ● Firewalls o Often just works ● SSL VPN o Juniper, Cisco, CheckPoint, …
  • 26. Benefits of SSL VPNs over VPNs For Web protocols: HTTP and WebSockets ● No client-side installation ● No client-side configuration ● Any client device
  • 27. WebSockets For Native Apps ● .NET (4.5) WCF support ● Java EE (JSR-356) ● C/C++ - several Open Source implementations ● PHP - Rachet ● Node.js - multiple libraries
  • 28. WebSockets Extensions Utilizing Sec-WebSocket-Extensions in Request/Response Headers: 1. Compression (deflate) 2. Multiplexing
  • 29. What If It Doesn’t Connect? ● Use standard ports: 80, 443 o Or standard alternate ports: 8080, 8443, 8008 ● Use SSL, with proper certificates ● Upgrade SSL VPN, Firewall, … ● Disable anti-virus o Or exception, or disable packet inspection ● Fallback to HTTP / HTTPS
  • 30. Future Protocol For Everything? No, primarily when UDP is required ● Streaming Video or Video Conferencing ● Remote access over bad connections (“Framehawk” scenario)
  • 31. The Future, Future Protocol ● For UDP: WebRTC with data-channels o Use WebSockets as fallback ● For TCP: WebSockets o Use HTTP / HTTPS as fallback ● HTTP / HTTPS for RESTful APIs
  • 32. Summary WebSockets couple the performance and flexibility of TCP with the reach of HTTP Prediction: WebSockets will replace simple TCP as preferred underlying protocol Existing protocols wrapped in WebSockets

Hinweis der Redaktion

  1. First released as part of Windows NT 4.0
  2. RD Gateway now also tries UDP and falls back to HTTPS
  3. Origin can only be trusted with web clients (how do you know if it’s a web client?)
  4. Header size: 2 - 14 bytes Length: 0-125 (7 bit) 126 + 16 bit 127 + 64 bit For security reasons a client MUST mask all frames that it sends to the server. The server MUST close the connection upon receiving a frame that is not masked. A server MUST NOT mask any frames that it sends to the client. A client MUST close a connection if it detects a masked frame. Masking is required to avoid proxy cache poisoning
  5. Source: Microsoft Comparison of the unnecessary network throughput overhead between the polling and the WebSocket applications
  6. Additional events: onclose and onerror
  7. SSL encrypted WebSockets have better chance of making it through
  8. The client initiates the negotiation by advertising the permessage-deflate extension in the Sec-Websocket-Extensions header. In turn, the server must confirm the advertised extension by echoing it in its response. Both client and server can selectively compress individual frames: if the frame is compressed, the RSV1 bit in the WebSocket frame header is set
  9. Or is very slow
  10. WebRTC data-channels utilize SCTP - Stream Control Transmission Protocol https://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol