javascript - What can service workers do that web workers cannot? -


what can service workers web workers cannot?

it seems web workers subserset of functionality of service workers. correct?

there pretty difference in intended for:

web workers

web workers provide simple means web content run scripts in background threads. worker thread can perform tasks without interfering user interface. in addition, can perform i/o using xmlhttprequest (although responsexml , channel attributes null). once created, worker can send messages javascript code created posting messages event handler specified code (and vice versa.)

source - using web workers

service worker

service workers act proxy servers sit between web applications, , browser , network (when available). intended (amongst other things) enable creation of effective offline experiences, intercepting network requests , taking appropriate action based on whether network available , updated assets reside on server. allow access push notifications , background sync apis.

source - service worker api

so web workers handy run expensive scripts without causing user interface freeze, while service workers useful modify response network requests (for examle when building offline app).


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -