- From: Jimmy Wärting <notifications@github.com>
- Date: Thu, 25 Apr 2019 13:32:26 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/980/486827233@github.com>
There are [good usecases](https://github.com/w3c/webrtc-pc/pull/317#issuecomment-170610532) too with having long running service worker. Service worker are better then SharedWorker if it were not for the short lifetime. in a since that it can handle FetchEvent. Stay alive durning reload, do backgroundFetch, push, sync and much more. i think the short lifetime is stupid and it will only make developer do this kind of hack, clearly there are good usecases for having long lived service worker too. developers have asked for long lived service worker many times. This is one of those things that would make you develop a Native app instead of a PWA, which is sad. but if we are worried about things like Coinhive, can't browser then instead help to defeat them with a prompt saying something like > "example.com" is running a high CPU intensive Service worker" or > "example.com" have been running a worker for more then 20 minutes" > > `[kill it]` `[block it]` `[keep it alive]` Developer would do good by trying to avoid those message from ever poping up. another acceptable solution would be to ask for permission. ```js navigator.permissions.request({name: 'long-lived-sw'}) ``` WebTorrent, IPFS. PeerCloud, Webtorrent, PeerCDN, StreamRoot, and Peer5 would all benefit from having WebRTC in service worker and run for longer period of time. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/980#issuecomment-486827233
Received on Thursday, 25 April 2019 20:32:48 UTC