service-worker

increase Service Worker life time

做~自己de王妃 提交于 2019-12-10 22:06:00
问题 I'm trying push notifications using service workers. use my own server to send notifications and eventSource is used to establish the connection. after i open the webpage service worker is running perfectly. but it stops after few seconds. what i want is to run service worker without getting stopped. i want it to run until the browser is opened. can anyone recommend a way to do that. ? this is my ServiceWorker JS /** * */ 'use strict'; var eventSource2 = new EventSource("Servlet"); console

does service worker request, response from server continuously?

岁酱吖の 提交于 2019-12-10 19:38:28
问题 I'm using server send event to display a notification.I have created a service worker and i used EventSource to connect with the server (in my case i used a servlet. ) once i run the project. everything is working fine. but the contents inside the event execute countiously. I want to know why? my other question is once i close the tab. it stops sending notification. service worker is nunning and server also running. but why it stops? this is my service worker code. var eventSource = new

What is the expected startup experience for a Progressive Web Application?

跟風遠走 提交于 2019-12-10 19:23:52
问题 Testing a Progressive Web Application. When I start the app in airplane mode, I get an unexpected startup/splash experience (Android/Chrome). Launch from Home Screen Experience I see a white screen, followed by a brief flash of the "offline dinosaur" before the app successfully starts and all is well. The startup time is longer than I expected, especially after testing with Chrome Devtools on a laptop, where startup is near instant. Since it is a little tricky to debug where this time is

Is there a Service Worker startup waitUntil to delay processing fetch?

我怕爱的太早我们不能终老 提交于 2019-12-10 18:45:35
问题 Is it possible to get service workers to wait to begin processing fetch events until asynchronous work completes at service worker startup? I have an app shell with routes defined in data. To install specific route fetch handlers at service worker startup, I need to lookup route data from IndexedDB (asynchronous). Unfortunately, the service worker starts accepting fetch events before the IndexedDB lookup can complete and setup fetch handling for routes. For now, I'm just hardcoding a special

PWAs on iOS 12 no longer shares Service Worker cache with Safari?

被刻印的时光 ゝ 提交于 2019-12-10 18:31:02
问题 For the PWA on iOS 11 we solved the external third party login opened in Safari by storing the login details in the service worker web cache. This no longer works in iOS 12 (in beta as of writing). I think this must be because the PWA now has its own service worker cache that it no longer shares with Safari, but I can't confirm this. Does anyone know if there is a way to share the service worker cache between safari and the PWA? Note that we already tried IndexedDB, but that is not shared,

How to test service workers offline mode in localhost?

醉酒当歌 提交于 2019-12-10 18:11:19
问题 How can I test service workers in offline mode locally? I mean, localhost doesn't need internet access so it just keeps fetching all the files. Can I simulate offline in Firefox or Chrome somehow so I can see what happens when caching fails, or other things go wrong? 回答1: In Chrome, you can simulate being offline in the DevTools' Application tab, inside the Service Workers panel. You will see there a checkbox that says "Offline" . 回答2: Also, you could go to the Networks tab and perform the

Service Worker skipWaiting unable to activate currently waiting SW

て烟熏妆下的殇ゞ 提交于 2019-12-10 17:46:42
问题 Description: We are using sw precache for caching the scripts before hand, hence to update the scripts we are giving reload option, for that we are listening the worker message to skip waiting the newly install service worker for unknown reason we are not getting correct importScript // GETTING OLD SW reference (self) and NOT getting newly installed SW reference self.addEventListener('message', function(event) { *// not working* self.skipWaiting(); }); // But if we put skipWaiting() in

Play a sound with Firebase when browser receives a notification while running in the background

﹥>﹥吖頭↗ 提交于 2019-12-10 17:39:23
问题 I would like to know how to play a sound with Firebase Cloud Messaging (FCM) when the web browser such as Chrome, Firefox, etc. receives a notification message while running in the background. notification while running in the background To receive a message while the app is in the background, in FCM, call setBackgroundMessageHandler in the service worker firebase-messaging-sw.js messaging.setBackgroundMessageHandler(function(payload) { console.log('[firebase-messaging-sw.js] Received

Remotely debugging service worker on chrome android with self signed certificate

浪尽此生 提交于 2019-12-10 17:35:01
问题 I was trying to debug a service worker served from my dev machine and running inside chrome android on the smartphone. I was using the usb connection and remotely debugging from my dev machine. The service worker works only in https and I can live with that, both chrome and firefox where refusing to register the SW. Then I used a self signed certificate on my dev machine, which obviously was not trusted by the mobile browsers. They warned the certificate was not good but gave the option to

PWA - manifest attribute “display”: “standalone” not working on Android

左心房为你撑大大i 提交于 2019-12-10 17:25:15
问题 I've noticed a really weird behaviour of my PWA. I can launch it in "standalone" mode on Windows, but when I'm trying to do the same on my Android device it's ignoring the "standalone" value and opens the url in Chrome (Android 7.0, Chrome-Android v62.x). It also doesn't work in Chrome-Android Beta v63.x (relating to this post what refers to a bug in chrome 62.x ). I've checked the manifest file with the Manifest Validator and Lighthouse. Both tools validated the file and don't show me any