4
votes

I am creating a PWA and following the example for subscribing to push notifications as detailed in this Google Lab - Adding Push Notifications to a Web App

The example uses Firebase Cloud Messaging (FCM) but we already have an Azure Notification Hub

Am I able to register with ANH using the same approach (JS only) - would it be a case of sending an API call with a payload containing the hub name, connection string and registration id?

1
Did you manage to build your PWA and send notifications to users with the ANH? I'm interested in doing this for our client's website as well.Leia

1 Answers

1
votes

You can check this documentation about Tutorial: Push notifications to Chrome apps with Azure Notification Hubs. There a sample code there that can send an API call containing the hub name, connection string and registration id.

Note: The sample uses CryptoJS v3.1.2. If you downloaded another version of the library, make sure you properly substitute the version in the src path.

Where CryptoJS is a growing collection of standard and secure cryptographic algorithms implemented in JavaScript using best practices and patterns.