Real time notifications
This feature allows to interact with Telefonica Kernel notification system https://developers.baikalplatform.com/docs/latest/notification-system/
Configuration
info
The configuration of subscription to Telefonica Kernel events must be done previously manually by the LA, providing the following endpoint of the lab https://api.stg.livingappsmaker.com/events as a callback url.
Use
Use the subscribe() function to open a websocket to receive real-time notifications for the logged-in customer.
You must provide a callback function that will be invoked when a message is received for the customer.
subscribe() returns the current state of the WebSocket connection, anything other than 1 (OPEN) should be considered as an error.
Example:
function callback<T>(data: T, error?: Error) {...}
const socketReadyState = await laSdk.notifications.subscribe( callback );