Closed souvickcse closed 4 years ago
@souvickcse It appears phonegap-plugin-push
supports Web Push for Firefox and Chrome but the registration ID returned is not an FCM registration token.
It is a VAPID Web Push subscription token which you can only send to each browser vendor's Web Push API and not through FCM, nor node-gcm
.
Therefore closing this as it is not related to FCM.
Hi, Can you please suggest me any npm(both for client and server) through which I can avail the push functionalities for web, iOS, and android? Thank You.
You can keep using node-gcm
for iOS and Android (through FCM), but for Web Push, just on your backend side, use another package such as web-push
:
https://github.com/web-push-libs/web-push
const webpush = require('web-push');
// VAPID keys should only be generated only once.
const vapidKeys = webpush.generateVAPIDKeys();
webpush.setGCMAPIKey('<Your GCM API Key Here>');
webpush.setVapidDetails(
'mailto:example@yourdomain.org',
vapidKeys.publicKey,
vapidKeys.privateKey
);
// This is the same output of calling JSON.stringify on a PushSubscription
const pushSubscription = {
endpoint: '.....',
keys: {
auth: '.....',
p256dh: '.....'
}
};
webpush.sendNotification(pushSubscription, 'Your Push Payload Text');
Ok Thank You.
Expected Behaviour
Unable to send push notifiction to browser. For example
Actual Behaviour
I am getting this :
Reproduce Scenario (including but not limited to)
Every time.
Steps to Reproduce
Add push functionality in ionic app:
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Firefox 77.0.1
Cordova CLI version and cordova platform version
Plugin version
Sample Push Data Payload
Sample Code that illustrates the problem