Websockets - Ajax Killer?: Sergej Schmidt @unfug
Websockets - Ajax Killer?: Sergej Schmidt @unfug
Index
1
Definition
Why?
Usecase(s)
Definition
Definition
API originally defined by HTML5
Since 12-2012 protocol in RFC 6455
Client side stuff by w3c
Full-duplex comunication with a remote host
Through a single socket
Layer 3 Protocol
Definition
Why?
Usecase(s)
Why?
Ian Hickson
Reducing kilobytes of data to 2 bytesand reducing
latency from 150ms to 50ms is far more than marginal.
In fact, these two factors alone are enough to make Web
Sockets seriously interesting to Google.
Proxy
Solves proxy problems
Through HTTP CONNECT
Definition
Why?
Usecase(s)
Usecase(s)
Usecase(s)
Asynchronous Communication (Ajax style dynamic web pages)
HTTP Long Polling (discussed later)
Video-Streaming
Long Polling
Figure : LongWebsockets
Polling- Ajax Killer?
Bandwith
Benchmarks
CometD benchmark
Comet - Ajax push technology for long polling
CometD is an HTTP-based event routing bus
Benchmark on Amazon EC2 in Sep - 2011 by Greg Wilkins
Benchmarks
Figure : HTTP-benchmark
Sergej Schmidt @UnFUG
Benchmarks
Figure : websocket-benchmark
Websockets - Ajax Killer?
Protocol
Implementation
Protocol
Implementation
Protocol
Implementation
Frame
Figure : WS Frame
WS Frame
OP-Code - 0x0 continous frame, 0x1 for text, 0x2 for binary
(0x3-0x7 reserved, not defined yet)
If text must be UTF-8, binary is interpreted by client
Text starts with 0x00 and ends with 0xFF, binary must have a
length
Sergej Schmidt @UnFUG
Protocol
Implementation
Frame
WS Control Frames
OP-Code - 0x8 Close, 0x9 Ping, 0xA Pong
0xB - 0xF reserved, not defined yet
Protocol
Implementation
Impelemntation
Demo of http://www.websocket.org/echo.html
Security
Security
Security
Encryption: Tunneling through TLS controlled through URI
ws vs. wss
Same origin policy
Masking against cache poisoning
No Authentication (use Cookies :)
Sources
end
if(!questions)
return \0