Enabling WebSocket compression across Pusher Channels socket infrastructure

Websockets_compression_blog

We are enabling WebSocket compression across our socket infrastructure and as such will be deprecating legacy versions of WebSocket protocol.

Introduction

On Wednesday 18 October 2023 we’ll be enabling WebSocket compression across our socket infrastructure. In order to do this we’ve upgraded one of our components which is responsible for handling low-level WebSocket communications and as such, will be deprecating legacy versions of WebSocket protocol, which are not supported for this upgrade.

As of this date we will continue to support v13 (the most recent and recommended protocol), hixie-75 (draft protocol 75) and hixie-76 (draft protocol 76).

What is WebSocket compression?

JSON messages exchanged by the majority of WebSocket servers are frequently made up of very repetitive text data. This makes them ideal for compression. Enabling compression on messages can significantly reduce network traffic.

The RFC 7692 is a framework for creating WebSocket extensions that add compression functionality to the WebSocket protocol, and defines WebSocket per-message Deflate, a compression extension based on the DEFLATE algorithm.

An extension based on this framework compresses the payload data portion of the WebSocket data messages on a per-message basis using parameters negotiated during the opening handshake.

To achieve compression, it must be supported by both the client and the server. On the client-side, feasibility will depend on the underlying implementation of WebSockets. All modern browsers support compression. As for non-browser clients, some do and some do not.

How will this impact my implementation?

Our libraries support WebSocket protocol version 13 and so there should be no requirement to upgrade the Pusher SDK. 

You may need to check the underlying browser or device supports WebSocket protocol v13. Fortunately, this version has been recommended since 2011 and so all modern browsers and mobile devices already has support. 

Channels users will need to ensure that their clients have the most recent versions of software which provide low-level WebSocket implementations. We are making this update with the assumption that no Channels users are continuing to run on older versions of the WebSocket protocol. Versions lower than v13 have been advised against since 2011.

If your clients run on systems which support the most recent version of WebSocket protocol the transition will be seamless. If the client supports compression, it will be enabled and used. If it doesn’t, messages will be delivered exactly as they are now.

If you have any questions about assessing your current WebSocket protocol version please refer to the FAQ in our support centre.

We’re continuing to keep our platform secure and performant by staying up to date and eliminating outdated functionalities. Want to speak to our support team about these improvements? Get in touch here.