2

In the context of Progressive Web Apps (PWA) there are two terms that I am trying to better understand:

What is the difference between them and their intended use? Are they similar in any ways? Or may be they are in some relation?


In my current understanding, a Service Worker is truly the foundation of a PWA; i.e. the object which enables a web app as a "registrable" app for mobile platform, allows offline functionality, and so on.

Whereas a Web Worker is an entity which allows [JavaScript] code execution in a background, non-UI thread with all the ensuing consequences (such as no direct DOM manipulation).

  • Dear down voter, care to explain what is wrong with my question or it's the Software Engineering's notorious unfriendliness? – Igor Soloydenko Sep 6 '18 at 21:55
1

NOTE: I read the links you gave and tried to figure out. I have no other experience with the subject. From the docs, both kinds of workers look like daemon processes listening to events coming from the "main process" of a page. Both have no access to DOM and communicate with the "main process" using pipes or futures which are conceptually similar.

A Web Worker waits on a queue and processes (arbitrary) messages as it receives them. It can do arbitrary computation or I/O, within the page's security confines.

A Service worker waits on a URL-like resource, and processes access to it as it is requested. It can do things like routing, prefetching, caching, or substituting a remote resource for a local copy when offline. The example by the link you gave explains this in detail.

Probably the latter can be, and is, implemented in the terms of the former.

  • Thanks for helping getting confidence in understanding. Probably the latter can be, and is, implemented in the terms of the former. -- I agree, one is achievable by means of the other, but I don't know if it is actually the case (which is curious of course). – Igor Soloydenko Sep 7 '18 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.