service-worker

Browser support for Service Worker Task Scheduler

人盡茶涼 提交于 2019-12-12 11:42:08
问题 Does anybody know, whether the TaskScheduler API for service workers as described here is supported by any browser or when or whether it will be implemented in the future? Unfortunately there is only very poor documentation about the features of service workers in regards to different browsers. So any references would be much appreciated. 回答1: https://www.w3.org/TR/2015/NOTE-task-scheduler-20150723/ contains the following note: This specification is being republished as a Working Group Note

Apply changes to Web App Manifest on an installed PWA

一世执手 提交于 2019-12-12 10:37:34
问题 If I want to make changes to my Progressive Web App, e.g. a slight change on the app name, or update the logo, is it possible to force an update on all my users' installed apps? I tried adding "?v=2" to the manifest URL, <link rel="manifest" href="/manifest.json?v=2" /> And also forced an update on the service worker. However, it doesn't seem to apply the new changes on the installed app. I tried this on Google Chrome on Android. 回答1: Forcing the update explicitly is not possible as per the

Chrome extension: Serviceworker cross origin failing

送分小仙女□ 提交于 2019-12-12 06:51:47
问题 Docs claim that: By adding hosts or host match patterns (or both) to the permissions section of the manifest file, the extension can request access to remote servers outside of its origin My &Lt;manifest.json&Gt;: {"manifest_version":2,"name":"","version":"0","permissions":["http://example.org/"],"background":{"scripts":["asd"]}} &Lt;asd&Gt;: navigator.serviceWorker.register('sdf.js',{scope:'http://example.org/'}).then(x=>console.log('done', x)) &Lt;sdf.js&Gt;: addEventListener('fetch', e=> e

Push notification is not being sent to chrome(desktop level)

ぃ、小莉子 提交于 2019-12-12 04:26:07
问题 This is My server.js code which uses web-push module to send the notification. exports.sendWelcomePushNotification = function (req, res) { var details = { endpoint: req.body.endpoint, key: req.body.key, secret: req.body.authSecret } webPush.sendNotification(details.endpoint, {TTL: 0, payload: 'You have subscribed to Pushnotification.', userPublicKey: details.key, userAuth: details.secret}).then(function () { res.sendStatus(200).json({message: 'User successfully subscribed'}); }); }; This my

Chrome Web Notification Push Unauthorized Registration exception

随声附和 提交于 2019-12-12 04:17:48
问题 I am implementing push notifications from my server to the users who are subscribed to my server. Right now sending the push notifications to Firefox users works like a charm. However, on Chrome I get an Unauthorized Registration error. I am using Django as a backend. In this image are the relevant parts of the error and my code (email edited), aswell as the subscription. If any more information is needed please let me know. Does anyone know why I can't send push notifications on Chrome? And

Push notification with service worker in mozilla firefox

孤街醉人 提交于 2019-12-12 03:28:10
问题 I am new to service worker and trying to learn it. I am implementing push notification using service worker. I am looking for simple demo code for pushing at server side and receive at client side notification as a reference in developing my web application. Suggestions will be very helpful. I am using node.js for implemention. Thank you. 回答1: You can look at the examples in the Web Push category of the ServiceWorker Cookbook. The examples are using the web-push Node.js library. 来源: https:/

Inroducing service-workers on mobile site

别来无恙 提交于 2019-12-12 03:05:37
问题 I'm new to service workers. I want to integrate service workers in my site.My motive is to improve the performance of my website not making the website offline.Its a real estate website. So what i have done till now is create modular templates of my site and store them in the cache. for e.g. template1 <div> <p>#data</p> <div> whenever a fetch occurs on my page i first call an api through ajax get the data and replace the #data variable in the cache response by actual api response and then i

Service worker: Redirecting a user to different url when he clicks the notification

橙三吉。 提交于 2019-12-12 02:23:21
问题 This snippet helps in either bring in the app tab in focus or open a new tab with that URL. If the tab is already open, is there a way to change the URL (based on the notification the user clicked).? event.waitUntil( clients.matchAll({ type: 'window' }) .then(function(windowClients) { for (var i = 0; i < windowClients.length; i++) { var client = windowClients[i]; if (url.test(client.url) && 'focus' in client) { return client.focus(); } } if (clients.openWindow) { return clients.openWindow('/#

Missing push data on Android's PWA but not on Desktop

旧街凉风 提交于 2019-12-12 00:37:07
问题 UPDATE: Updating Chrome from 58 to 76 has resolved the issue. According to this link Chrome v50+ supports payload which has not been the case here. Either there's a bug / issue with Chrome 58 or there's a bug somewhere in the code. Still interested to learn which. I'm following the same procedure to send my push message for both Mobile and Desktop. Server (node.js): const webpush = require('web-push') const vapidKeys = { publicKey: '...', privateKey: '...', } webpush.setVapidDetails( 'mailto:

push subscription has unsubscribed or expired, with statusCode 410

坚强是说给别人听的谎言 提交于 2019-12-11 15:56:24
问题 Push subscription has unsubscribed or expired, with statusCode 410 , in less then 24 hours. I'm using web-push to send notifications with fcm-endpoint & vapidDetails. It works fine for few hours, I can send notifications. But just after few hours saved-fcm-endpoint-subscription is getting unsubscribed or expired, with statusCode 410 , when I try to send notification from the backend. I'm deploying & checking in Heroku. The below code is to save subscription-object in the server/backend. swReg