Methods
(abstract) error(event) → {void}
Implement this callback to execute your code when an error occurs in the SDK. This unified error
event captures all errors from different sources (REST API, WebSocket, hooks, SDK state, UI error messages).
Use the source field to filter and handle specific error types.
Events can originate from:
- SDK library (REST API validation, hook errors, SDK state errors)
- Adapter/ADT (REST API failures, WebSocket errors, UI error messages)
applicationApi.subscribe({
error: (event) => {
console.error(`[${event.source}] ${event.errorMessage}`);
switch (event.source) {
case 'rest-api':
// Handle REST API errors (from SDK or adapter)
console.log('Status:', event.context.statusCode);
break;
case 'websocket':
// Handle WebSocket errors
console.log('Subscription:', event.context.subscriptionId);
break;
case 'hook':
// Handle hook errors (SDK only)
console.log('Hook:', event.context.hookName);
break;
case 'sdk':
// Handle SDK state errors (SDK only)
console.log('Method params:', event.context.methodParams);
break;
case 'ui-message':
// Handle UI error messages (adapter only, displayType: 'error')
console.log('Message:', event.context.messageText);
break;
}
}
});
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
event |
ErrorEvent
|
Error event data
|
Returns:
- Type:
-
void
(abstract) loginStateChanged(params) → {void}
Implement this callback to execute your code when login state is changed. Agent login consists of some steps following in particular order. You can use this event to detect the state. For example, you can get application configuration in 'WORKING' state only.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
params |
object
|
|
Returns:
- Type:
-
void
(abstract) sessionInitialized() → {void}
Implement this callback to execute your code when web socket initialization complete.
Returns:
- Type:
-
void
(abstract) uiNotification(notification) → {void}
Implement this callback to execute your code when UI notifications (info/success messages) are displayed.
applicationApi.subscribe({
uiNotification: (notification) => {
console.log(`[${notification.displayType}] ${notification.messageText}`);
}
});
Parameters:
| Name | Type | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
notification |
object
|
Notification data
|
Returns:
- Type:
-
void