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 2024-11-12 01:42:48 +0530 +0530

ON THIS PAGE