HTML and CSS Reference
Web applications use the HTTP protocol for their functioning, and HTTP essentially uses the request-
response model. Plain HTTP isn't well suited for performing two-way communication. Web Sockets,
therefore, need to upgrade plain HTTP to the WebSocket protocol. This upgrade takes place while
establishing the connection between the client and the server. WebSocket is a TCP-based protocol and
uses HTTP only during the handshake and upgrade process. Once a connection is established between the
client and the server, WebSocket communication takes place over a single TCP connection. The WebSocket
protocol can deal with text as well as binary data. Due to these features, the WebSocket protocol offers
performance benefits over the HTTP request-response model.
The request and response headers in Figure 11-7 show how this upgrade takes place.
Figure 11-7. Request and response during a handshake, shown in Chrome Developer Tools
Notice how the request and response headers set the Connection and Upgrade headers. In order to
upgrade the communication from plain HTTP to WebSocket, you need a web server that is capable of
doing this upgrade. IIS 8.0, which ships with Windows 8, can accept Web Socket communications. If you're
developing a web application that uses HTML5 Web Sockets, you may need to install WebSocket support
in IIS 8.0. Figure 11-8 shows how you can use the “Turn Windows features on or off” option from the
Control Panel to install the WebSocket protocol.