push-api

PushManager subscription promise never fulfill nor reject

独自空忆成欢 提交于 2020-01-01 04:55:13
问题 I am currently facing an issue with some Chrome (Chromium) version where the PushManager.subscribe promise from a ServiceWorker stays in a pending state . The code itself is pretty simple : return serviceWorkerRegistration.pushManager.subscribe({ userVisibleOnly: true }); I have a valid and accessible JSON manifest , providing the GCM Sender ID . I also tried different implementations, as described in this post, but the result is still the same. The subscription part works well with every 47+

Make Web push notification work using webview in a native android app?

╄→尐↘猪︶ㄣ 提交于 2019-12-22 04:04:03
问题 I have a website which is responsive and push notification feature enabled. In my native android app, if i load my website in a WebView , then the pop up which usually comes in chrome/firefox to ask if user wants to allow push notification or not, doesn't shows up in WebView . And obviously the WebView won't support the same web push notification for the app. I know how to implement GCM or FCM in app to enable mobile push, but i wanted to know if it possible just to club the web push

How can we implement web push notification?

蹲街弑〆低调 提交于 2019-12-22 01:19:32
问题 How to implement push notification in browsers using the googles GCM service. What are the steps to implement the same. 回答1: The basic steps that you will have to do if you want to add push notifications in browsers are the following: First of all, you need an HTTP S webpage (GCM requires it for browser notifications). Secondly, you need to add some javascript code into your webpage that will do the following points: Ask the user for push permissions Register the browser that are accessing

Why does this code fail to execute 'fetch'?

馋奶兔 提交于 2019-12-21 21:35:26
问题 I'm working on push notifications using service workers. I'm using the XHR(Ajax) approach to get my notification, here is a code snippet of service-worker.js: var API_ENDPOINT = new Request('/getNotification', { redirect: 'follow'}); event.waitUntil( fetch(API_ENDPOINT, {credentials: 'include' }) .then(function(response) { console.log(response); if (response.status && response.status != 200) { // Throw an error so the promise is rejected and catch() is executed throw new Error('Invalid status

Google Chrome Silent Push Notifications

北城余情 提交于 2019-12-18 13:15:52
问题 I've been reading through the docs for Chrome's implementation of the Web Push API here, and I noticed the API says "you promise to show a notification whenever you receive a push" and under limitations it's stated "you have to show a notification when you receive a push message". After implementing the example on my localhost, I used cURL to send a push notification successfully. I was curious, so I commented out the lines that actually call the showNotification function, and put in a

Custom Push Service

冷暖自知 提交于 2019-12-13 02:52:34
问题 In the context of pushing notifications to web-browsers, the PUSH SERVICE acts as interface between the SERVICE WORKER and APPLICATION SERVER. My current understanding is that Google FCM is the Push Service for Google Chrome & FireFox browsers APNS (Apple Push Notification Service) is the Push Service for Safari browser Here, is it technically possible to substitute the ‘push service(s)’ (– i.e., Google FCM for Google Chrome & FireFox browsers and APNS for Safari) with a generic custom

Can service-worker stop push notification sent by GCM api?

删除回忆录丶 提交于 2019-12-12 18:07:09
问题 In my current architecture, I submit push notifications using the GCM API. This triggers a 'push' event in the service worker. The service worker then adds some data to the notification. If the service worker is unable to add the data, due to some error, I am getting a blank notification. Can service workers avoid showing notifications sent by GCM? 回答1: From the Push Notifications guide at Google Developers: You must pass a {userVisibleOnly: true} argument to the subscribe() method. This

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:/

PushPad: Chrome doesn't display push-notifications

北慕城南 提交于 2019-12-12 02:15:01
问题 This question results from following question (see comment section): PushPad: Subscribe is removed after site refresh I've got a problem using PushPad. I've created a project, implemented the code and so on. My problem is that Chrome does not display push-notifications I sent (desktop and mobile version) . Using Firefox everything works fine. I get notifications displayed in the second I sent them. After some time, I found the Function "Emulate Push Event" in the Chrome Developer Tool

GCM webpush in background

两盒软妹~` 提交于 2019-12-11 03:56:07
问题 I implemented web push notifications. Steps to get a bug: Open website Subscribe for push notifications Send many pushes through gcm - all fine Close tab with site Send push and receive "double push" - first one is ok, second is "This site has been updated in background" Reopen website Send push - all fine I know this can happen when the service worker receives push and doesn't show notification. But I see normal notification, why I also see other strange notification? Can I get rid such