What can service workers do that web workers cannot?

Buksy’s answer is correct but in my opinion it does not answer the original question, namely: “What can service workers do that web workers cannot? Or vice versa?” There are fundamental differences in their lifecycle and the number of instances per origin you can have. In short: | Web Workers | Service Workers | |————–|————–|——————| … Read more

JavaScript multithreading

Web Workers. They’re a W3C standard (well, a working draft at the moment) for exactly this, and require no plugins: This specification defines an API that allows Web application authors to spawn background workers running scripts in parallel to their main page. The specification also discusses spreading workers across multiple cores, for true concurrency (this … Read more

Do Shared Web Workers persist across a single page reload, link navigation

I have done some testing to find out the answer to this in practice. Firefox does not yet support creating WebSocket connections from Web Workers: https://bugzilla.mozilla.org/show_bug.cgi?id=504553 So Firefox is not relevant until that bug is resolved. IE 10 doesn’t have support for Shared Web Workers so it’s not relevant either. So that leaves Chrome. Here … Read more

Sharing websocket across browser tabs?

After seeing this question, I’ve finally implemented sharing socket and added to my library a few days ago. It seems to work in most of browsers including even in IE6, but except Opera. For Opera, you may use regular checking instead of unload event. Check releated issue at https://github.com/flowersinthesand/portal/issues/21 ###Leaving a cookie Set cookie to … Read more