Everybody gets WebSockets

by John Roberts.

Two summers ago, with a seemed-big-at-the-time network of 28 datacenters, not long after introducing Medellin, CloudFlare introduced support for WebSockets, initially for our Enterprise customers.

CC BY 2.0 image by Marcin Wichary

Today, with our network nearing 80 global locations, we're pleased to announce support for WebSockets for all our customers, including Enterprise, Business, Pro, and Free, with resources allocated by plan level.

What are WebSockets?

If you don't want to read RFC 6455, then this short paragraph from our previous blog post explains:

The WebSocket protocol is a distinct TCP-based protocol, however, it’s initiated by an HTTP request which is then "upgraded" to create a persistent connection between the browser and the server. A WebSocket connection is bidirectional: the server can send data to the browser without the browser having to explicitly ask for it. This makes things like multiplayer games, chat, and other services that require real-time exchange of information possible over a standard web protocol

There's a lot more technical history in that post covering how we modified NGINX to support a huge number of connections through port reuse. But the bottom line is that WebSockets are a vital technology for web sites that need to get real-time updates for features like social feeds, multimedia chat, collaborative editing, multi-player gaming, stock updates, and more.

Performance & Latency

Because the WebSocket protocol creates a single connection and doesn’t require HTTP requests, WebSockets can provide anywhere from 500:1 to a 1000:1 reduction in unnecessary HTTP header traffic, compared to HTTP polling solutions.

The server no longer needs to wait for a request to come back before it sends new data; it can simply push the data to the client the moment it has new information. Tests have shown a 3:1 reduction in latency compared to other polling solutions.

   

Modern Internet, for More People

Last week, we expanded our deep support for HTTP/2 to include Server Push. HTTP/2 was finalized as a spec in 2015, so almost a newborn child as technologies go. (We're excited to help HTTP/2 grow up fast.)

By comparison, WebSockets is already a toddler, as RFC 6455 was finalized in 2011.

But, perhaps because of complexity or expense, WebSockets hasn't seen as wide adoption as we'd expect. CloudFlare is removing those obstacles, and frankly we're curious to see what happens.

We are building a better Internet, and while that may sound like a platitude... making modern tech easy to use matters. We're eager to see what our customers do to play, grow, and thrive with another tool available.

Read more about WebSockets generally, or review details in our support article.

comments powered by Disqus