From dc9c8eb0999462a2da6a6811c205f5c53a784738 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 3 Dec 2017 21:33:03 +0100 Subject: [PATCH] Updated SW explanation --- sw/service-worker.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sw/service-worker.ts b/sw/service-worker.ts index 347555e9..a9e3e153 100644 --- a/sw/service-worker.ts +++ b/sw/service-worker.ts @@ -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