eventsource_ex
eventsource_ex copied to clipboard
Add support for retry
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
Nice suggestion!
I had a similar thought when working on a library that depends on eventsource_ex, see https://gitlab.com/adamwight/mediawiki_client_ex/-/issues/15 . In my case, I want backpressure from the consumer to stop the SSE client from continuing to supply events. Ideally, it records the offset and disconnects from the server. Reconnecting will resume at that offset.
This is interestingly similar to the "if connection to the server is lost" use case mentioned in the MDN docs, perhaps this library offer some kind of wrapper (eg. an OTP app) which holds the most recent offset, has Supervisor functionality to politely restart a listener after the connection is spontaneously dropped, and this could also respond to "disconnect" / "reconnect" events send by its consumer? Anyway, it doesn't need to happen all in the same issue but there might be some overlap...