Register a Client for Receiving Web Push Notifications

The enableNotification() method registers a client for receiving push notifications from your web application. The notification reference used in the code snippet below is the component instance created earlier.

The enableNotification() method returns a promise which is resolved to an object. After resolving the promise, you can handle the notification message through the messagehandler.

    
copy
//Register the client var notification = catalyst.notification; notification.enableNotification().then((response) => { //Create a handler for the message when received catalyst.notification.messageHandler = (msg) => { //Action to be performed when the message is generated } });

You can then send push notifications to the registered client either from the Catalyst console, or through this API.

Last Updated 2023-11-14 13:20:49 +0530 +0530

ON THIS PAGE