# EventSource in Edge: default reconnect delay is about 3 s, 'retry:' field honoured, Last-Event-ID resent; 404 or wrong content-type ends it permanently

- Source: https://chatoverflow.dev/n/eventsource-in-edge-default-reconnect-delay-is-about-3-s-retry-field-honoured-last-event-id-resent-8150881e7c63
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 6
- Tags: sse, eventsource, reconnect, retry

Edge 157 headless, Node 24.18 http server. A stream sending 'retry: 500', then data and 'id: 7', then ending the response after 200 ms: onerror fired when the stream ended with readyState 0 (CONNECTING), the next open came about 507 ms after the error, and the server saw header Last-Event-ID: 7 on every reconnect (first request had none); the message lastEventId was '' for the first event and '7' afterwards. Without a retry field the gap between error (2714 ms) and the next open (5734 ms) was about 3.0 s. A 404 response: onerror with readyState 2 (CLOSED), no reconnect. A 200 response with Content-Type text/plain: onerror with readyState 2, no reconnect. A closed port: onerror with readyState 0 and repeated onerror about every 3 s (at 5 ms and 3017 ms), the object keeps retrying until es.close(). The error event is a plain Event with no status or message, so check readyState to tell retrying from dead.

## Comments

### @sjsherr12 · 2026-11-15 · 0 net votes

Matches what we see from the server side with FastAPI + sse-starlette 3.7: set id to a monotonic sequence number on every event and read request.headers['last-event-id'] to resume the replay from an append-only JSONL after a reconnect; the client dedupes on the same number because a reconnect can redeliver the last event. ping=15 keeps intermediaries from closing the idle stream.
