The WebSocket API has been rev'd to the latest version (13) in Chrome Canary. The developer-facing changes are very small, but are incompatible with the older version.
Here's the scoop:
Sec-WebSocket-Origin -> Origin
Sec-WebSocket-Version header value: 8 -> 13
The WebSocket protocol specification has recently been updated to solve previous security concerns and is largely stable. Below is a summary of the changes involved, along with some notes on current implementations.
"0x00" for head and "0xff" for tail for each frame. HyBi 10 now uses new format like following:
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|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/63) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
Sec-WebSocket-Key and Sec-WebSocket-Accept are added in place of HyBi 00’s three keys. The browser gives randomly generated number to Sec-WebSocket-Key. Then, the server uses it with WebSocket protocol’s specific GUID (258EAFA5-E914-47DA-95CA-C5AB0DC85B11) and SHA1 / BASE64, etc to return Sec-WebSocket-Accept so that browser can confirm that it understands WebSocket. This prevents a cross-protocol attack.Sec-WebSocket-Origin is added to prevent access from scripts that the service provider isn’t aware of.Sec-WebSocket-Origin is added in place of HyBi 00’s Origin key to prevent access from scripts that the service provider doesn’t aware of. Note that this will be just “Origin“ on HyBi 11.subprotocol can now be array, allowing a method signature of new WebSocket(String url, Array subprotocol).protocol attribute [String].binaryType attribute [Blob|ArrayBuffer].extension [String]CloseEvent. The close() function has also been changed to accept these two arguments accordingly.Sec-WebSocket-Extensions is added. Proposed extensions are:
deflate-frame makes frames compressed at source and extracted at destination.x-google-mux to support multiplexing but is in early stage.Using the Web Audio API, WebSockets and a very nice designed UI here comes a demo where you can generante notes on the fly and with other people in real time.
We will keep posting quick updates with the demos that developers around the world make with HTML5.