Upload
vti
View
3.975
Download
6
Embed Size (px)
DESCRIPTION
WebSockets are the the juicy part of the HTML5 specification. They promise the solution to the edgy real-time web communication. But how widespread are they and what are the technologies that can safely replace them in older browsers? This talk is about the current state of WebSockets and how to use them from Perl applications with some fun live examples.
Citation preview
var ws = new WebSocket(’ws://localhost’);
ws.onmessage = function(e) {
var message = e.data;
alert(’Got new message: ’ + message);
};
ws.send(’Hello, world!’);
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 |R|R|R| opcode |M| Payload l e n | Extended pay load l e n g t h || I |S |S |S | (4 ) |A| (7 ) | (16/63) ||N|V|V|V| |S | | ( i f pay load l e n ==126/127) || | 1 | 2 | 3 | |K| | |+−+−+−+−+−−−−−−−+−+−−−−−−−−−−−−−+− − − − − − − − − − − − − − − +| Extended pay load l e n g t h cont inued , i f pay load l e n == 127 |+ − − − − − − − − − − − − − − − +−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+| |Masking−key , i f MASK s e t to 1 |+−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+| Masking−key ( con t i nued ) | Payload Data |+−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− − − − − − − − − − − − − − − +: Pay load Data con t i nued . . . :+ − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − − +| Payload Data con t i nued . . . |+−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−+
Dra f t #75−−−−−−−−−Chrome 5S a f a r i 5 . 0Andro id 2 . x
Dra f t #76−−−−−−−−−F i r e f o x 4b ( d i s a b l e d )S a f a r i 5 . 0 . 2Chrome 6−13Opera 10 .70 ( d i s a b l e d )
iOS 4 .2
Dra f t #10−−−−−−−−−F i r e f o x 10Chrome 14
RFC 6455−−−−−−−−Chrome 14+F i r e f o x 10+IE 10
Protocol::WebSocket (Dancer,Net::Async::WebSocket, Web::Hippie)
75, 76 (00), 10, 17, RFC 6455 + browserworkarounds