Web Sockets - 402-advanced-javascript-traebennett/seattle-javascript-401d31 GitHub Wiki

WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.

What this means is that Websockets can be used and implemented into your applications to communicate over other connections. To establish a WebSocket connection, the client sends a WebSocket handshake request, for which the server returns a WebSocket handshake response. This would be an exmaple of the code.

GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw== Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 Origin: http://example.com

Here would be the server response! HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk= Sec-WebSocket-Protocol: chat