Tieske
Tieske

Reputation: 406

Server-Sent events server response if the Last-Event-Id is no longer available

I'm writing a client for an SSE stream. I've searched the docs but can't find the answer. I use the following process:

  1. The client subscribes to the event stream
  2. Fetches the current state of some resources using another regular GET request
  3. Starts handling the events on top of the retrieved state, such that it can track the entire state incrementally on client side.

If my client for a longer period cannot connect to the stream, at some point the Last-Event-Id that my client is passing to the server in the reconnect attempts will be too old. The server will have dropped it from its cache. So when it reconnects, it will have missed a number of events.

With SSE in general, how can the client tell its last ID is outdated and restoring the connection won't work. In my case I have to go back to step 2, refetching the entire state again.

Or the other way around: how should a server deal with an unknown Event-Id passed in by the client?

Any help is greatly appreciated.

Upvotes: 0

Views: 1073

Answers (1)

Tieske
Tieske

Reputation: 406

Apparently there is no answer to this question, since it hasn't been specified in the spec (yet).

See comments here and issue filed here.

Upvotes: 1

Related Questions