Menu

1 / 2

How my 1.17 MB PWA updates itself without an app store (7-endpoint config fan-out + a strict service worker)

DEV Community: android·hammi·9 days ago
#xZUTjmQ2
#devtoandroid#devto#dev#config#cache
Reading 0:00
15s threshold

I build RKMovies, a small 4K media player that ships as a 1.17 MB Android APK and as a PWA on our own site. No Play Store means no update channel. So when we want to change a notice, a download link, or bump the version prompt, the app has to fetch config at runtime.

Here is what we landed on in updater.js and sw.js .

The config fan-out

fetchConfig() fires 7 GET requests concurrently: raw.githubusercontent.com, cdn.jsdelivr.net, our own domain, a Cloudflare Pages mirror, rentry, paste.ee, and a local /config.json . Every request gets an AbortController with a 4-second timeout and cache: "no-store" . A response only counts if it parses as JSON and has at least one of platforms , version , or notice .

The point of 7 endpoints is that any single host can be blocked, slow, or wrong. If our domain is unreachable from some ISP, jsdelivr still answers. If GitHub raw is slow, the Pages mirror answers.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.