re: Is there any pattern for handling network error when sending requests? VIEW POST

re: About the concept of queuing requests in the cache, waiting to send them when the network condition are good, I also thought about the Cache API bu...

I also thought about the Cache API but I wondered is there any tool of pattern or does someone already implemented it on his app.

Isn't that what the service worker does? Using the cache API

So If I understand correctly, and I managed to see this behavior when I worked on a service worker library, on Chrome I notice kind of an exponential time for retries when I shut down my network and register cache strategies on my web page. Interesting.

Exponential backoff for retry strategies is a good way to avoid flooding the upstream server. If the server is telling you "I'm having issues", flooding it with a request every N milliseconds it's not going to help the server (you end up creating a denial of service) nor the user experience (too many requests and errors to show)

Yes exactly, the service worker is taking advantage of the Cache API to handle network issues, you only need to implement the algorithm or use Workbox.js.

I guess exponential retry strategy is good. I wonder if there is variants like "up to a certain number of retry" etc... Really exciting, thanks to Service Workers we are closer to native app experience! I hope others browsers will support the Background Sync API soon!

code of conduct - report abuse