Comments on: The Difference Between Web Sockets, Web Workers, and Service Workers https://css-tricks.com/the-difference-between-web-sockets-web-workers-and-service-workers/ Tips, Tricks, and Techniques on using Cascading Style Sheets. Mon, 12 Dec 2022 15:16:24 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: John Crim https://css-tricks.com/the-difference-between-web-sockets-web-workers-and-service-workers/#comment-1798009 Mon, 12 Dec 2022 15:16:24 +0000 https://css-tricks.com/?p=374731#comment-1798009 A key architectural difference between Service Worker and other Workers is that the web page/tab controls the lifetime and activation of regular workers, whereas Service Workers are started/stopped by the browser, and only guaranteed to be kept alive for the duration of event handlers.

Shared Worker is most similar to Service Worker b/c it is shared between tabs from the same origin. But Shared Worker lifetime is controlled by the app – so you can keep it around as long as it’s useful, and it can be stateful. Service Worker lifetime is controlled by the browser, and is often killed when idle. Service Worker can be started/stopped many times a second (whenever no event handlers are running).

Unfortunately Shared Worker is not yet implemented on Chrome Android, but it is implemented on all other major browsers.

This issue tracks Shared Worker on Chrome Android – hopefully coming soon! And there’s also some discussion on the tradeoffs between Service Worker and Shared Worker.

]]>
By: Peter https://css-tricks.com/the-difference-between-web-sockets-web-workers-and-service-workers/#comment-1797705 Fri, 11 Nov 2022 19:54:43 +0000 https://css-tricks.com/?p=374731#comment-1797705 Thanks for the update

]]>
By: Paul https://css-tricks.com/the-difference-between-web-sockets-web-workers-and-service-workers/#comment-1797674 Mon, 07 Nov 2022 18:18:44 +0000 https://css-tricks.com/?p=374731#comment-1797674 Great article Aisha, this was informative

]]>