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

Reconnect and Retry-After #116

Closed
ParkFramework opened this issue Sep 4, 2015 · 7 comments
Closed

Reconnect and Retry-After #116

ParkFramework opened this issue Sep 4, 2015 · 7 comments

Comments

@ParkFramework
Copy link

It would be very helpful to have a option: isRetry

fetch(url, {
    isRetry: true
})

If network offline or other network problems, auto reconnect to be successful connect.

If server response code error status, and has HTTP header Retry-After,
retry send this request, after time specified value in header.

HTTP/1.1 503 Service Unavailable
Retry-After: 3

What do you think about it?

@annevk
Copy link
Member

annevk commented Sep 4, 2015

This should be very easy to implement on top of the existing API. Why does it warrant native support?

@ParkFramework
Copy link
Author

Because it is always necessary and I do not know the reason why every programmer has to write it in js code.

The same functionality is in the Chrome browser, it is enabled by default
chrome://flags/#enable-offline-auto-reload
the same behavior i want in Fetch.

This is useful for Single Page Application.
Thank.

@annevk
Copy link
Member

annevk commented Sep 16, 2015

Are there libraries that support this in this manner already? How often are they used?

@ParkFramework
Copy link
Author

We use it in my libraries over XHR.
It is very important in the mobile internet, for SPA (Single Page Application)

@annevk
Copy link
Member

annevk commented Sep 22, 2015

This seems worth considering once such a library becomes very successful. Until that point this is implementable on top of fetch() quite easily.

@annevk annevk closed this as completed Sep 22, 2015
@chiefcll
Copy link

chiefcll commented Jul 8, 2021

I'd like to reopen this issue. There are libraries and they are used heavily - https://github.com/axios/axios

I'm also in this boat - I love the simplicity of fetch and eventually get the request for - "We need retry logic". I assume a lot of developers have this problem and I personally hate rewriting retry logic in every app. But I also want to avoid adding another 15kb lib for one or two features I actually need.

@annevk
Copy link
Member

annevk commented Jul 19, 2021

@chiefcll can you open a new issue outlining the kind of retry support you are looking for? It would also help to see more evidence for developers selecting libraries for retry support in particular.

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

No branches or pull requests

3 participants