Java Reference
In-Depth Information
GET /ticket-agency-websockets/tickets HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: localhost:8080
Origin: http://localhost:8080Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: TrjgyVjzLK4Lt5s8GzlFhA==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate;
client_max_window_bits, x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/
537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/
537.36
Cookie: [45 bytes were stripped]
We can see that the client requests an upgrade connection with WebSocket as the target
protocol on the URL /ticket-agency-websockets/tickets . It additionally
passes information about the requested version and key.
If the server supports the request protocol and all the required data is passed by the client,
then it would respond with the following frame:
HTTP/1.1 101 Switching Protocols
X-Powered-By: Undertow 1
Server: Wildfly 8
Origin: http://localhost:8080
Upgrade: WebSocket
Sec-WebSocket-Accept: ZEAab1TcSQCmv8RsLHg4RL/TpHw=
Date: Sun, 13 Apr 2014 17:04:00 GMT
Connection: Upgrade
Sec-WebSocket-Location: ws://localhost:8080/
ticket-agency-websockets/tickets
Content-Length: 0
The status code of the response is 101 (switching protocols) and we can see that the serv-
er is now going to start using the WebSocket protocol. The TCP connection initially used
for the HTTP request is now the base of the WebSocket session and can be used for trans-
missions. If the client tries to access a URL, which is only handled by another protocol,
Search WWH ::




Custom Search