push-api

Is it possible to use the new Push Notifications support in Chrome without GCM?

帅比萌擦擦* 提交于 2019-12-07 05:33:20
问题 Can I use a push service other than Google's GCM when using the new Push API with service workers? 回答1: Today, Chrome is the only browser that supports the standard push API so right now the short answer is No. A longer answer involves doing different things for different browsers Safari offers desktop notifications via APNS and a proprietary API Firefox is shipping support for push notifications soon and presumably will use a different push server than GCM. So to summarize, it seems that

Is it possible to use the new Push Notifications support in Chrome without GCM?

安稳与你 提交于 2019-12-05 09:49:44
Can I use a push service other than Google's GCM when using the new Push API with service workers? Today, Chrome is the only browser that supports the standard push API so right now the short answer is No. A longer answer involves doing different things for different browsers Safari offers desktop notifications via APNS and a proprietary API Firefox is shipping support for push notifications soon and presumably will use a different push server than GCM. So to summarize, it seems that different combinations of Browser/OS will require different push servers. In the future there is an IETF draft

How can we implement web push notification?

可紊 提交于 2019-12-04 21:06:36
How to implement push notification in browsers using the googles GCM service. What are the steps to implement the same. 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 into the webpage Activate a ServiceWorker that will be waiting for notifications (and when a notification is

Why does this code fail to execute 'fetch'?

社会主义新天地 提交于 2019-12-04 15:20:19
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 code from API: ' + response.status); } // Examine the text in the response return response.json(); })

PushManager subscription promise never fulfill nor reject

人走茶凉 提交于 2019-12-03 13:57:28
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+ version, the issue appears with older releases. (I'm using Chromium continuous builds to test the

How to add analytics for Push notifications

♀尐吖头ヾ 提交于 2019-12-03 13:48:16
问题 I'm working on progressive web app, and I want to implement analytics for Push notifications. How can I add analytics for push notifications so that I'll be able to track and record how many people clicked on notification and how many people close that notification without clicking on it. 回答1: I've written a small chunk of code to use Google analytics for analytics and it works fairly well. Dumped notes here: https://gauntface.com/blog/2016/05/01/push-debugging-analytics The way I've done

GCM registration id in Service Worker in Push Notification for chrome

百般思念 提交于 2019-12-03 12:42:50
问题 I am able to send push notification and in service worker i am making a service call i just to want to send GCM registration id with that service call. How to get registration id or subscription id in service worker here is my code self.addEventListener('push', function(event) { console.log('Received a push message from local', event); var title = 'My title file. Testing on'; var body = 'New Push Message.'; var icon = 'refresh_blueicon.png'; var tag = 'my-push-tag'; event.waitUntil( // Here i

How to add analytics for Push notifications

偶尔善良 提交于 2019-12-03 03:41:11
I'm working on progressive web app, and I want to implement analytics for Push notifications. How can I add analytics for push notifications so that I'll be able to track and record how many people clicked on notification and how many people close that notification without clicking on it. Matt Gaunt I've written a small chunk of code to use Google analytics for analytics and it works fairly well. Dumped notes here: https://gauntface.com/blog/2016/05/01/push-debugging-analytics The way I've done this is the post mentioned above: In the service worker I import a javascript file that does the

PushPad: Subscribe is removed after site refresh

醉酒当歌 提交于 2019-12-02 03:36:43
问题 I've integrated PushPad and managed to get it working for static Push's. Now I wanted to combine it with some PHP and Javascript-Functions to make it dynamic. Here is my code: <script> (function(p,u,s,h,x){p.pushpad=p.pushpad||function(){(p.pushpad.q=p.pushpad.q||[]).push(arguments)};h=u.getElementsByTagName('head')[0];x=u.createElement('script');x.async=1;x.src=s;h.appendChild(x);})(window,document,'https://pushpad.xyz/pushpad.js'); //Install Pushpad pushpad('init', myprojectnumber); alert(

PushPad: Subscribe is removed after site refresh

喜你入骨 提交于 2019-12-02 02:31:39
I've integrated PushPad and managed to get it working for static Push's. Now I wanted to combine it with some PHP and Javascript-Functions to make it dynamic. Here is my code: <script> (function(p,u,s,h,x){p.pushpad=p.pushpad||function(){(p.pushpad.q=p.pushpad.q||[]).push(arguments)};h=u.getElementsByTagName('head')[0];x=u.createElement('script');x.async=1;x.src=s;h.appendChild(x);})(window,document,'https://pushpad.xyz/pushpad.js'); //Install Pushpad pushpad('init', myprojectnumber); alert("Pushpad initialised"); //Check subscribe-status pushpad('status', function (isSubscribed, tags){ //User