HTML and CSS Reference
In-Depth Information
Let's look at an example handshake recorded during a connection to
ws://echo.websocket.org/echo . Until the handshake completes, a WebSocket session
conforms to the HTTP/1.1 protocol. The client sends the HTTP request shown in Listing 3-1.
Listing 3-1. HTTP Request from the Client
GET /echo HTTP/1.1
Host: echo.websocket.org
Origin: http://www.websocket.org
Sec-WebSocket-Key: 7+C600xYybOv2zmJ69RQsw==
Sec-WebSocket-Version: 13
Upgrade: websocket
Listing 3-2 shows the server sending back the response.
Listing 3-2. HTTP Response from the Server
101 Switching Protocols
Connection: Upgrade
Date: Wed, 20 Jun 2012 03:39:49 GMT
Sec-WebSocket-Accept: fYoqiH14DgI+5ylEMwM2sOLzOi0=
Server: Kaazing Gateway
Upgrade: WebSocket
Figure 3-6 illustrates the HTTP request upgrade to WebSocket from the client to the
server, also known as the WebSocket opening handshake.
Figure 3-6. Example of a WebSocket opening handshake
 
Search WWH ::




Custom Search