2.7.2 WebSocket Support

The WebSocket protocol is an extension to the HTTP 1.1 protocol to enable two-way communication between a client and a server. It is an independent TCP-based protocol. The protocol has two parts - handshake and data transfer. HTTP servers interpret its handshake as an upgrade request. By default, the WebSocket protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over Transport Layer Security (TLS).

The protocol works in the following sequence:

  1. The client sends an HTTP upgrade request to the server through Access Gateway to establish a communication channel between the client and the server. (WebSocket protocol handshake)

  2. The server sends an HTTP 101 response to the requesting client through Access Gateway. When the client receives the response, the HTTP connection is upgraded to WebSocket.

  3. Bidirectional data exchange happens between the server and the client over the WebSocket connection.

  4. Either of the participant in the data exchange requests to terminate the WebSocket connection. One participant sends a Close request to the other participant and the connection is terminated.

WebSocket enables Access Gateway to accept an HTTP upgrade request from a client.

The following diagram illustrates the flow of messages among the client, Access Gateway, and the server in a WebSocket communication:

Figure 2-7 WebSocket Communication