SlideShare a Scribd company logo
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

More Related Content

PPTX
Google Chromebook for the Enterprise: Yeah or Meh?
PDF
GWT Web Socket and data serialization
PPTX
Websockets
PDF
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
PDF
WebSockets with Spring 4
KEY
Pushing the web — WebSockets
PPTX
Web sockets in Java
PPTX
Php push notifications
Google Chromebook for the Enterprise: Yeah or Meh?
GWT Web Socket and data serialization
Websockets
WebSockets: The Current State of the Most Valuable HTML5 API for Java Developers
WebSockets with Spring 4
Pushing the web — WebSockets
Web sockets in Java
Php push notifications

What's hot (20)

PPTX
Asynchronous Web Programming with HTML5 WebSockets and Java
PDF
Building Next Generation Real-Time Web Applications using Websockets
PPTX
Intro to WebSockets
PPT
WebSockets and Java
KEY
Dancing with websocket
PDF
Going Live! with Comet
PDF
Time for Comet?
PDF
Using WebSockets with ColdFusion
PPTX
PPTX
Websockets and SockJS, Real time chatting
PDF
LCA2014 - Introduction to Go
PPT
HTML5 WebSocket: The New Network Stack for the Web
PDF
Introduction to WebSockets
PDF
Websocket 101 in Python
PDF
Real-time Web Application with Socket.IO, Node.js, and Redis
PDF
Cowboy rabbit-websockets
PPS
J web socket
PDF
Realtime web application with java
PPT
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
PPTX
Smart Gamma - Real-Time Web applications with PHP and Websocket.
Asynchronous Web Programming with HTML5 WebSockets and Java
Building Next Generation Real-Time Web Applications using Websockets
Intro to WebSockets
WebSockets and Java
Dancing with websocket
Going Live! with Comet
Time for Comet?
Using WebSockets with ColdFusion
Websockets and SockJS, Real time chatting
LCA2014 - Introduction to Go
HTML5 WebSocket: The New Network Stack for the Web
Introduction to WebSockets
Websocket 101 in Python
Real-time Web Application with Socket.IO, Node.js, and Redis
Cowboy rabbit-websockets
J web socket
Realtime web application with java
Camelone-2012 HTML5 WebSocket ActiveMQ/Camel
Smart Gamma - Real-Time Web applications with PHP and Websocket.
Ad

Viewers also liked (17)

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

Similar to WebSockets Everywhere: the Future Transport Protocol for Everything (Almost) (20)

PPTX
PPTX
ClientServer Websocket.pptx
PPTX
HTML 5 - Web Sockets
PPTX
WebSockets in JEE 7
ZIP
Websockets at tossug
PDF
Nuts and Bolts of WebSocket Devoxx 2014
PDF
DevCon 5 (July 2013) - WebSockets
PPTX
presentation in .net programming web sockets.pptx
PDF
Web sockets in java EE 7 - JavaOne 2013
PDF
Dev con kolkata 2012 websockets
PPTX
Html5 websockets
PDF
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
PDF
Programming WebSockets - OSCON 2010
PPTX
WebSockets-Revolutionizing-Real-Time-Communication.pptx
PPTX
Enhancing Mobile User Experience with WebSocket
PPT
JUG louvain websockets
PPTX
WebSockets On Fire
ZIP
Websocket protocol overview
PPTX
vlavrynovych - WebSockets Presentation
PDF
Websockets
ClientServer Websocket.pptx
HTML 5 - Web Sockets
WebSockets in JEE 7
Websockets at tossug
Nuts and Bolts of WebSocket Devoxx 2014
DevCon 5 (July 2013) - WebSockets
presentation in .net programming web sockets.pptx
Web sockets in java EE 7 - JavaOne 2013
Dev con kolkata 2012 websockets
Html5 websockets
IRJET- An Overview of Web Sockets: The Future of Real-Time Communication
Programming WebSockets - OSCON 2010
WebSockets-Revolutionizing-Real-Time-Communication.pptx
Enhancing Mobile User Experience with WebSocket
JUG louvain websockets
WebSockets On Fire
Websocket protocol overview
vlavrynovych - WebSockets Presentation
Websockets

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
1. Introduction to Computer Programming.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
1. Introduction to Computer Programming.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Programs and apps: productivity, graphics, security and other tools
Network Security Unit 5.pdf for BCA BBA.
The Rise and Fall of 3GPP – Time for a Sabbatical?
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
SOPHOS-XG Firewall Administrator PPT.pptx
Electronic commerce courselecture one. Pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectral efficient network and resource selection model in 5G networks
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Unlocking AI with Model Context Protocol (MCP)

WebSockets Everywhere: the Future Transport Protocol for Everything (Almost)

  • 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

Editor's Notes

  • #4: First released as part of Windows NT 4.0
  • #6: RD Gateway now also tries UDP and falls back to HTTPS
  • #16: Origin can only be trusted with web clients (how do you know if it’s a web client?)
  • #22: 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
  • #24: Source: Microsoft Comparison of the unnecessary network throughput overhead between the polling and the WebSocket applications
  • #25: Additional events: onclose and onerror
  • #26: SSL encrypted WebSockets have better chance of making it through
  • #29: 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
  • #30: Or is very slow
  • #32: WebRTC data-channels utilize SCTP - Stream Control Transmission Protocol https://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol