Updated SW explanation

This commit is contained in:
Eduard Urbach 2017-12-03 21:33:03 +01:00
parent f02db2b9b8
commit dc9c8eb099

View File

@ -2,7 +2,20 @@
// This is the service worker for notify.moe.
// When installed, it will intercept all requests made by the browser
// and return a cache-first response. By always returning cache first,
// and return a cache-first response.
// request request
// Browser -------> Service Worker ------> notify.moe Server
// <-------
// response (cache)
// <------
// response (network)
// <-------
// response
//
// -> Diff cache with network response.
// By always returning cache first,
// we avoid latency problems on high latency connections like mobile
// networks. While the cache is being served, we start a real network
// request to the server to see if the resource changed. We compare the