1
votes

I am creating a PWA that I want to use Azure Notification Hub for Push Notifications

Reading the flow of registration for ANS, this document tells me that I must first obtain a PNS handle from the native service. https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-registration-management

The device first retrieves the PNS handle from the PNS, then registers with the notification hub directly

Using JavaScript, I am able to retrieve the handle which looks like this...

{"endpoint":"https://fcm.googleapis.com/fcm/send/ewOnb-xuHQM:APA91bH7FWNQ9h9RKnOGHvxfPaF3OSr6FbnofFnLcE-bf6LtSYeNcDrCPN7DmwpcrKolUYQCw5qYI2UGZfaUkrGr555hfMkoCMFEchq6_yIUoPyyCxtQsT5Y6Cgc_c2jYD-HoQnvnWJV","expirationTime":null,"keys":{"p256dh":"BPYcgtxUvSYDNYn6EVuu1BmIAz2vTU-TLdYb6pTAMOHTyJE1t8JLdBw1LLTljp5JMbnZF_Lk1ZoCV6nAJTUbDac","auth":"7cZDn_upNP_9HKO2NYhMbA"}}

Using the REST API for ANS, how do I pass this value (and which part) to register my device with the hub? And am I able to do this through JavaScript (not node.js) rather than backend?

1

1 Answers

0
votes

Push notification service is meant to receive notifications on mobile devices. PNS handle simply means the Mobile Device Token that you receieve from APNS in case of Apple devices, GCM for android devices. You use this Mobile device token as "Handle" in case of Azure Notification hubs.