Skip to content

Commit f6054ff

Browse files
authored
docs: Add GZip exclusion instructions for Transmit SSE (#35)
### Summary This PR updates the documentation to address issues caused by GZip compression interfering with Server-Sent Events (SSE) when using `@adonisjs/transmit`. It explains how to disable GZip for the `text/event-stream` content type while keeping compression enabled for other content types. ### Changes 1. Added a new section: "Avoiding GZip Interference" in the `transmit.md` file. 2. Included configuration examples for: - **Traefik**: Demonstrates how to use the `excludedcontenttypes` option.
1 parent 91eec9c commit f6054ff

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Here are a few things you should know before using this module.
5454
- [Syncing](#syncing)
5555
- [Ping](#ping)
5656
- [Events](#events)
57+
- [Avoiding GZip Interference](#avoiding-gzip-interference)
58+
5759

5860
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
5961

@@ -173,6 +175,21 @@ transmit.on('unsubscribe', ({ uid, channel }) => {
173175
})
174176
```
175177

178+
# Avoiding GZip Interference
179+
180+
When deploying applications that use `@adonisjs/transmit`, it’s important to ensure that GZip compression does not interfere with the `text/event-stream` content type used by Server-Sent Events (SSE). Compression applied to `text/event-stream` can cause connection issues, leading to frequent disconnects or SSE failures.
181+
182+
If your deployment uses a reverse proxy (such as Traefik or Nginx) or other middleware that applies GZip, ensure that compression is disabled for the `text/event-stream` content type.
183+
184+
## Example Configuration for Traefik
185+
186+
```plaintext
187+
traefik.http.middlewares.gzip.compress=true
188+
traefik.http.middlewares.gzip.compress.excludedcontenttypes=text/event-stream
189+
traefik.http.routers.my-router.middlewares=gzip
190+
```
191+
192+
176193
[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/adonisjs/transmit/test.yml?branch=main&style=for-the-badge
177194
[gh-workflow-url]: https://github.com/adonisjs/transmit/actions/workflows/test.yml 'GitHub action'
178195
[npm-image]: https://img.shields.io/npm/v/@adonisjs/transmit.svg?style=for-the-badge&logo=npm

0 commit comments

Comments
 (0)