electric-sql / electric-sql/electric

Feature request: Document and make `sse_timeout` configurable

Open
#3,635 1 comment 2 reactions 0 assignees View on GitHub
feature request triage
Dominant language
TypeScript
Stars
10.4k
Forks
375
Avg merge
3d 1h
Merged PRs (30d)
18

Description

**Is your feature request related to a problem? Please describe.**
First of all, thank you for all the work on this project. It's excellent.

I'm using live mode with SSE and it was (and still is somewhat) unclear to me why the SSE connection times out after 60 seconds. The documentation appears to imply that the SSE connection should live indefinitely to prevent the long-polling behavior. But it times out after 60s and reopens another SSE connection https://github.com/electric-sql/electric/blob/f6e7c7548e40539e13775e9758074fb42c09f6af/packages/sync-service/lib/electric/shapes/api.ex#L25

I'm assuming this is related to the magic done for request collapsing, but, at least to me, it sort of __looks__ like a bug based on how the documentation is written. Especially because a keep-alive message is sent every 21s, which appears at odds with this behavior.

**Describe the solution you'd like**
Could someone offer an explanation of why the 60s timeout is in place? And if it could potentially allow for indefinite connection duration, perhaps we could make it configurable through env vars (i.e., `ELECTRIC_SSE_TIMEOUT` defined in ms, where `0` is indefinite).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.