web-push

Firebase Cloud Messaging (WebPush) token expiration handling

∥☆過路亽.° 提交于 2019-12-13 01:09:51
问题 As I found out in Firebase source, every token has an expiration time of one week. And because messaging().onTokenRefresh is not implemented now, I'm assuming that there is no way of sending webpush-notifications to users that haven't been on my website with configured FCM for a week or longer. Or my assumption is incorrect and this expiration exists only on browser side? And tokens on the server-side of FCM aren't expiring without a call from browser to recreate token? 回答1: It's not an

How to send a notification to multiple subscribers using web-push package of Node.js?

风格不统一 提交于 2019-12-12 18:11:54
问题 How we can send a notification to multiple subscribers using web-push package of Node.js? We can loop through for list of subscribers but it won't be scalable for millions of subscribers. Example: for(var myKey in subData) { endp = subData[myKey]['ENDPOINT']; enckey = subData[myKey]['ENCKEY']; webPush.sendNotification(endp, 200, enckey, JSON.stringify({ title: 'Test Title', msg: 'Test Notification', })); } 回答1: Unfortunately, the Web Push standard currently doesn't support sending a

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

[WebPush][VAPID] Request fails with 400 UnauthorizedRegistration

牧云@^-^@ 提交于 2019-12-12 12:27:38
问题 I'm working on a pure java implementation for WebPush with VAPID and payload encryption (I've already made implementations for GCM and FCM). However the documentation is still marginal and also the code samples are still not substantial. At this moment i'm trying to get it to work in Chrome. allthough i get succesful subscriptions using VAPID, when i send either a Tickle or a Payload push message i get a 400 UnauthorizedRegistration. My guess is that it has something to do with the

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 Desktop Notification doesn't display the message

只愿长相守 提交于 2019-12-12 02:45:32
问题 I'm developing a website that supports desktop notifications. I'm utilizing GCM and Azure Notification Hub to send push messages to end users. I followed this codelab tutorial. When testing I have found that the push notifications do get displayed on the screen, but the message that I have written in the payload is not shown in the notification. So I again went through the codelab, and they have mentioned a body key in the showNotification method. Code self.addEventListener('push', function

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('/#

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

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

FCM data messages doesn't load in firefox

久未见 提交于 2019-12-11 11:38:52
问题 I am working on cloud messaging using Web FCM. When I send a notification with title and body, both firefox and chrome shows notification and works fine. But when I trying to send FCM Data Message, firefox doesn't receive and log Messages. I am using a HTTPS secure url and also this template. This is my javascript function: function sendMSG() { var _ID = $("#user_id").val(); var ServerKey = "SERVER_KEY"; var msg = { "to": _ID, "data": { "Nick": "Mario", "body": "great match!", "Room":