Websocket get update and handshacke get broken… this is not for sure and end version of the protocol, but since newer versions of chrome are using it and its not compatible with previous version its a good option to implement both.
In order to understand what changed, i recommend you to read the great resume done in Axod’s Hack .
Mainly you need to get 3 keys, 2 of them are send in the headers and the 3rd is sent after the headers. Then you need to do some “weird” transformation with the 3 and send them back after the header.
After having the 3 keys, here is the code in erlang to build the challenge to send back to client:
Now that you have the challenge just build the response like this :
Challenge = build_challenge(Key1,Key2,Key3),
HandshakeServer = [
"HTTP/1.1 101 Web Socket Protocol Handshake\r\n",
"Upgrade: WebSocket\r\n",
"Connection: Upgrade\r\n",
"Sec-WebSocket-Origin: ", Origin , "\r\n",
"Sec-WebSocket-Location: ws://", Location , "\r\n\r\n",
Challenge
],
As soon i can i will create a new branch on misultin web server so you can see the code working.