F5 GLOSSARY

WebSocket

WebSocket is one of the communication protocols used on the internet. It enables bidirectional communication between web servers and clients. The protocol is defined by the Internet Engineering Task Force (IETF) as "RFC 6455."

The web was initially designed to support hypertext, but it has since evolved toward enabling more dynamic web applications. A commonly adopted technique for achieving this is AJAX (Asynchronous JavaScript and XML), which uses XMLHttpRequest to facilitate granular data exchanges with web servers instead of page-level updates. This allows for a more responsive user experience. However, with AJAX, all data exchanges must originate from the client side, making it difficult for the web server to push data to clients proactively.

To address this limitation, Comet was developed as an extension of AJAX. Comet works by "intentionally creating requests with delayed responses," keeping the HTTP connection to the web server open so that the server can send responses whenever it wants to push information. However, Comet has a high resource consumption problem.

WebSocket was developed as an improvement over Comet and is available in HTML5. It keeps a connection between the server and client open, enabling continuous bidirectional communication using this connection. Today, major browsers support WebSocket.

A WebSocket connection is established via HTTP using the HTTP "Upgrade" header field to upgrade the connection into a WebSocket. Note that if a website uses an HTTP proxy that does not support WebSocket, the connection or communication may fail, so proper configurations are required.