> For the complete documentation index, see [llms.txt](https://docs.odds88.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.odds88.io/integration-process/recommended-integration-flow/feed-message-compression.md).

# Feed Message Compression

This feature includes every feed endpoints including:

* Delta Feed
* Settlement Feed
* Metadata Feed
* Pick'em Feed
* Translation Feed
* Cashout Feed

***

{% hint style="info" %}
**Compression is optional and disabled by default**\
Clients that want smaller and faster messages can **opt in**.\
Clients that do nothing will continue to work **exactly as before**.
{% endhint %}

### How It Works <a href="#how-it-works" id="how-it-works"></a>

* You can request compressed messages during the WebSocket connection setup
* If requested, the server:
  * Compresses each message using **GZip**
  * Sends messages as **binary WebSocket frames**
* If not requested:
  * Messages are sent as **plain text JSON**
  * No behavior change at all

This guarantees **full backward compatibility**.

***

### How to Enable Compression <a href="#how-to-enable-compression" id="how-to-enable-compression"></a>

To enable compression, you must send the following HTTP header **when opening the WebSocket connection**:

`X-Enable-Compression: true`

If the header is missing, compression is **not** used.

***

### What Changes When Compression Is Enabled <a href="#what-changes-when-compression-is-enabled" id="what-changes-when-compression-is-enabled"></a>

| Aspect                                    | Without Compression | With Compression          |
| ----------------------------------------- | ------------------- | ------------------------- |
| Message format                            | Text                | Binary                    |
| Payload                                   | Plain JSON          | GZip-compressed JSON      |
| Client action needed                      | None                | Decompress before parsing |
| Human readable in Postman / browser tools | Yes                 | No                        |

***

### Responsibilities <a href="#client-responsibilities" id="client-responsibilities"></a>

When compression is enabled:

* Messages arrive as **binary data**
* The data is **GZip-compressed**
* You must:
  1. Decompress the message
  2. Parse the resulting JSON

{% hint style="info" %}
**GZip is supported in all major programming languages**, so decompression is straightforward and widely available.
{% endhint %}

***

{% hint style="info" %}
Compression is applied **per WebSocket connection**, not per message
{% endhint %}

***

### Message Size Improvements <a href="#message-size-improvements" id="message-size-improvements"></a>

JSON data compresses very well because it contains many repeated field names and structured data.

**Typical Results**

| Original Message Size | After Compression | Size Reduction |
| --------------------- | ----------------- | -------------- |
| 20 KB                 | 4–6 KB            | \~70%          |
| 50 KB                 | 7–10 KB           | \~80–85%       |
| 120 KB                | \~18 KB           | \~85%          |
| 200 KB                | 20–30 KB          | \~85–90%       |

**What This Means for You**

* Much lower bandwidth usage
* Faster message delivery
* Lower latency on slow or mobile networks
* Better performance for high-frequency updates (e.g. odds or market changes)
