Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for retry #16

Open
cwc opened this issue Sep 10, 2022 · 1 comment
Open

Add support for retry #16

cwc opened this issue Sep 10, 2022 · 1 comment

Comments

@cwc
Copy link
Owner

cwc commented Sep 10, 2022

https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format

@adamwight
Copy link
Contributor

adamwight commented Sep 14, 2022

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...

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

No branches or pull requests

2 participants