UNPKG

radius-read

Version:

Realtime Dashboard

173 lines (172 loc) 5.82 kB
import { SocketIoClientInfo } from "./../models/socketio.model"; import { AppConfig } from "./../models/application.model"; /** * SocketIoClientService is a service class that manages the Socket.IO client connection and event handling. */ export declare class SocketIoClientService { /** * Application configuration for the Socket.IO client service. * @date Jun 26, 2025 03:51:27 PM * @author Biswaranjan Nayak * * @private * @type {!AppConfig} */ private _appConfig; /** * Client information for the Socket.IO client, including user info and socket connection. * @date Jun 26, 2025 03:51:40 PM * @author Biswaranjan Nayak * * @private * @type {!SocketIoClientInfo} */ private _clientInfo; /** * Server URL for the Socket.IO client connection, constructed from the application configuration. * @date Jun 26, 2025 03:51:51 PM * @author Biswaranjan Nayak * * @private * @type {!string} */ private _serverURL; /** * Last callback payload to avoid sending duplicate callbacks for the same event. * @date Jun 26, 2025 03:52:01 PM * @author Biswaranjan Nayak * * @private * @type {*} */ private _lastCallbackPayload; /** * Creates an instance of SocketIoClientService. * @param appConfig */ constructor(appConfig: AppConfig); /** * Initializes the Socket.IO client service with the provided client information, light event, custom light service entity, and light service entity. * @param clientInfo * @param lightEvent * @param customLightServiceEntity * @param lightServiceEntity */ init<LightServiceCustomEntity extends Record<string, string>, LightServiceEntity extends Record<string, string>, LightEvent extends Record<string, string>>(clientInfo: SocketIoClientInfo, lightEvent: LightEvent, customLightServiceEntity: LightServiceCustomEntity, lightServiceEntity: LightServiceEntity): void; /** * Initializes the Socket.IO client connection and registers event handlers for the provided light event, custom light service entity, and light service entity. * @param lightEvent * @param customLightServiceEntity * @param lightServiceEntity */ private initSocketIo; /** * Processes Socket.IO events based on the event type and performs actions accordingly. * @param event * @param lightEvent * @param lightServiceCustomEntity * @param lightServiceEntity */ private processSocketIoEvents; /** * Callback function that is called when the Socket.IO client is connected to the server. * @param event */ private onSocketIoConnected; /** * Processes light events based on the event type and performs actions accordingly. * @param event * @param lightEvent * @param lightServiceCustomEntity * @param lightServiceEntity */ private processLightEvents; /** * Gets the light service entity based on the provided service name and returns the corresponding entity. * @param serviceName * @param LightServiceCustomEntity * @param LightServiceEntity * @returns */ private getLightServiceEntity; /** * Callback function that is called when a user registration event occurs. * @param event * @param customLightServiceEntity * @param lightServiceEntity */ private onUserRegisteredEvent; /** * Callback function that is called when a real-time service registration event occurs. * @param event * @param customLightServiceEntity * @param lightServiceEntity */ private onRtServiceRegisteredEvent; /** * Callback function that is called when a service registration event occurs. * @param event */ private onServiceRegisteredEvent; /** * Callback function that is called when the state of AOPs changes. * @param event */ private onAOPsStateChangedEvent; /** * Callback function that is called when the state of an agent changes. * @param event */ private onAgentStateChangedEvent; /** * Callback function that is called when the state of an agent's terminal changes. * @param event */ private onAgentTerminalStateChangedEvent; /** * Callback function that is called when the state of an agent's queue changes. * @param event */ private onAgentQueueStateChangedEvent; /** * Callback function that is called when the state of a call changes. * @param event */ private onCallStateChangedEvent; /** * Callback function that is called when the state of a chat changes. * @param event */ private onChatStateChangedEvent; /** * Callback function that is called when the state of an email changes. * @param event */ private onEmailStateChangedEvent; /** * Callback function that is called when the state of a queue changes. * @param event */ private onQueueStateChangedEvent; /** * Callback function that is called when the state of a queue interaction changes. * @param event */ private onQueueXionStateChangedEvent; /** * Callback function that is called when the state of a social interaction changes. * @param event */ private onSocialStateChangedEvent; /** * Callback function that is called when the state of a video interaction changes. * @param event */ private onVideoStateChangedEvent; /** * Callback function that checks if the provided event is the last callback payload to avoid sending duplicate callbacks. * @param event * @returns */ private isLastCallbackPayload; }