client
server
RFC 6455: The WebSocket protocol
GET /websocket HTTP/1.1
Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: B64(<16-bytes-nonce>) Origin: http://example.com Sec-WebSocket-Protocol: chat, snapchat Sec-WebSocket-Version: 13
HTTP/1.1 101 Switching Protocols
Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: B64(SHA1-BINARY(B64(<16-bytes-nonce>) + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")) Sec-WebSocket-Protocol: chat
TCP communication
TCP: one endpoint closes the channel