Skip to content

Instantly share code, notes, and snippets.

@derekr
Last active November 12, 2025 22:44
Show Gist options
  • Select an option

  • Save derekr/fb8dd720d5c1600fefe3521d91ae83a4 to your computer and use it in GitHub Desktop.

Select an option

Save derekr/fb8dd720d5c1600fefe3521d91ae83a4 to your computer and use it in GitHub Desktop.
SSE FAQ

This is just a stub doc for collecting any SSE related tips/tricks/considerations others in the Datastar community want to share. While it will likely serve as a helpful resource itself, the content will be used to author a more user friendly doc or artifact to reference when learning and leveraging SSE.

SSE FAQ

Are there any SSE gotchas?

There are some known gotchas for SSE documented here:

@nickchomey
Copy link

  1. Compression should be done at the application level, not by a reverse proxy. Otherwise, depending on the frequency and content size of your event payloads, number of simultaneous connections, and their duration, you could potentially send large amounts of unnecessary data between your application and the reverse proxy. It will increase memory usage in both places, increasing server resource demands.

What about if the reverse proxy is on the same server - eg caddy in front of your app?

  1. Brotli compression should be preferred and used, if possible, as it can enable insane compression ratios (think 100s:1), if your response is well suited to it (ie the structure of your HTML is fairly similar across events and the SSE stream is long-lasting). This can result in barely any data transfer to the client over the lifetime of the connection.

What about zstd for browsers that support it?

@alvarolm
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment