May 5, 2020

Verizon Media Delivery provides support for WebSockets

By Katherine Merrick, Principal Product Manager

Low-latency applications typically require a faster means of communication than what HTTP can deliver. Examples include multiplayer online gaming or chat applications where real-time, interactive communications are needed to provide the right user experience. WebSockets is a real-time communication protocol that enables an open, continuous, two-way connection between a client and a server. This enables data to be sent to a client (i.e., a browser), even without the client having to request it. With the HTTP protocol, the server only responds if the client sends a request.

Financial institutions are another use case for WebSockets. Recently, we worked with a major North American bank who is using the WebSocket protocol to establish an open connection for their origin server to send real-time notifications whenever trades go through without the client having to poll for them. 

How does the WebSocket protocol work?

WebSocket connections start as regular HTTP connections. To establish a WebSocket connection, the client and server upgrade from the HTTP protocol to the WebSocket protocol during their initial handshake (this protocol switch is known as the WebSocket handshake). 

To initiate this upgrade the client sends a request to the server using the following headers:

  • Connection: Upgrade – indicates that the client wants to change the protocol
  • Upgrade: WebSocket – indicates that the requested protocol is “WebSocket”

If the server understands the WebSocket protocol and agrees to the switch, it sends back a special response code: 101 (Switching protocols) with the same two headers. At that point, the HTTP connection is replaced by the WebSocket connection over the same underlying TCP/IP connection. Once established, WebSocket data frames can be sent back and forth between the client and the server in full-duplex mode until one side closes the connection. 

The key benefits of WebSockets over HTTP include:

  1. Persistent connection: No need for the client to frequently reinitiate connections checking for new data.
  2. Lower latency: WebSockets use minimal overhead. Because there is a continuous connection, the normal overhead associated with HTTP requests, such as headers and other information, no longer needs to be sent, which reduces latency.
  3. Full-duplex communication: WebSockets offer bidirectional communications between the server and the client so that both parties can communicate and exchange data at the same time. 

Verizon Media is pleased to offer support for the WebSocket protocol across our entire worldwide delivery network. As we move into the age of IoT and edge computing, the WebSocket protocol will be beneficial for companies wanting to offer low-latency applications at the edge.

To learn how to implement WebSockets for your application, fill out the form below or call us today.

Contact us
Contact a rep
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Sales

Support

Manage your account or get tools and information.

More info