web-push

How to get registered into GCM topics from javascript (for Chrome)

回眸只為那壹抹淺笑 提交于 2019-12-01 03:42:36
问题 Here is a nice documentation on how to implement Google Cloud Messaging (GCM) in Chrome. But I do not found any reference here or anywhere how to subscribe to a topic using javascript (for Chrome). Here I have found a reference how to do the task for Android: https://developers.google.com/cloud-messaging/topic-messaging#subscribe-to-a-topic Java code(Android) for subscribe to a topic in GCM: private void subscribeTopics(String token) throws IOException { GcmPubSub pubSub = GcmPubSub

Google Chrome Silent Push Notifications

戏子无情 提交于 2019-11-30 09:49:53
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 console.log instead and found that I could, in fact, send, receive, and totally ignore a push notification.

Chrome Push Notification: This site has been updated in the background

烈酒焚心 提交于 2019-11-30 06:35:12
问题 While implementing the chrome push notification, we were fetching the latest change from our server. While doing so, the service-worker is showing an extra notification with the message This site has been updated in the background Already tried with the suggestion posted here https://disqus.com/home/discussion/html5rocks/push_notifications_on_the_open_web/ But could not find anything useful till now. Is there any suggestion ? 回答1: Generally as soon as you receive a push message from GCM

How can I test pushsubscriptionchange event-handling code?

限于喜欢 提交于 2019-11-30 05:17:39
问题 The pushsubscriptionchange event is fired by the browser when the push notification server wants the client to resubscribe. How can I manually trigger this event for testing? 回答1: Unfortunately it's not possible to do any end-to-end testing of this feature. The best you can do is fire the event via JS from the service worker: function triggerSubscriptionChange() { registration.pushManager.getSubscription().then(subscription => { if (subscription) { console.log("subscribed, subscription",

Service Worker Registration Failed

痞子三分冷 提交于 2019-11-29 13:26:20
I am currently working on service worker to handle push notification in browser. Currently I am having this "SW registration failed error". Can anyone help with this issue? Check client1.html and service-worker.js file below: ERROR: SW registration failed with error SecurityError: Failed to register a ServiceWorker: The URL protocol of the current origin ('null') is not supported. service-worker.js console.log('Started', self); self.addEventListener('install', function(event) { self.skipWaiting(); console.log('Installed', event); }); self.addEventListener('activate', function(event) { console

Can I use web push notifications to update the page without displaying a notification?

杀马特。学长 韩版系。学妹 提交于 2019-11-29 12:11:10
I am wondering if I can use web push notifications to update a web page without displaying a notification for the user to interact with. Essentially I want to refresh data after an event on the server. If this is possible, is it still necessary to receive permission from the user to send these push updates? Yes, you can send push messages without showing a notification, but there are limitations on both Firefox and Chrome on the raw number of "invisible" push messages and the rate at which you send them. You can experiment a bit with the quotas in different browers using the Push Quota

Chrome Push Notification: This site has been updated in the background

微笑、不失礼 提交于 2019-11-28 21:10:32
While implementing the chrome push notification, we were fetching the latest change from our server. While doing so, the service-worker is showing an extra notification with the message This site has been updated in the background Already tried with the suggestion posted here https://disqus.com/home/discussion/html5rocks/push_notifications_on_the_open_web/ But could not find anything useful till now. Is there any suggestion ? Satyajit Dey Generally as soon as you receive a push message from GCM (Google Cloud Messaging) you have to show a push notification in the browser. This is mentioned on

Can I use web push notifications to update the page without displaying a notification?

守給你的承諾、 提交于 2019-11-28 05:47:49
问题 I am wondering if I can use web push notifications to update a web page without displaying a notification for the user to interact with. Essentially I want to refresh data after an event on the server. If this is possible, is it still necessary to receive permission from the user to send these push updates? 回答1: Yes, you can send push messages without showing a notification, but there are limitations on both Firefox and Chrome on the raw number of "invisible" push messages and the rate at

WebPushError and UnauthorizedRegistration when try to send push notification to Chrome and Opera, Firefox is OK

风格不统一 提交于 2019-11-28 01:34:30
I managed to run a working example for sending web-push notifications - subscribe user for push notifications, get the endpoint, generate the two browser keys from the subscription object - p256dh and auth . On the server side I generate the VAPID keys. So, with all these I call sendNotification on the web-push Node.js package, and also - I'm passing a payload. On Firefox - I get the notification with the payload. On Chrome and Opera I get WebPushError: Received unexpected response code and furthermore - UnauthorizedRegistration and Error 400 . The server side code I'm using to send the stuff

Service Worker Registration Failed

痴心易碎 提交于 2019-11-27 19:28:47
问题 I am currently working on service worker to handle push notification in browser. Currently I am having this "SW registration failed error". Can anyone help with this issue? Check client1.html and service-worker.js file below: ERROR: SW registration failed with error SecurityError: Failed to register a ServiceWorker: The URL protocol of the current origin ('null') is not supported. service-worker.js console.log('Started', self); self.addEventListener('install', function(event) { self