Options
All
  • Public
  • Public/Protected
  • All
Menu

web socket class for agent copilot

Hierarchy

Index

Constructors

Properties

IsSubscribeDummyResponse: boolean = true
agentAssistInput: AgentAssistInput = empytyAgentAssistInput
agentId: string = ''
agenticHeartbeatState: HeartbeatMonitorState = ...
agenticReconnectInFlight: boolean = false
agenticWssWorker: Worker = null
auth: CXoneAuth = CXoneAuth.instance
cachedAgenticUrl?: string
cachedAgenticUrlExpiresAt: number = 0
connectionId: string = ''
heartbeatState: HeartbeatMonitorState = ...
lastHeartbeatReceivedAt: number = 0
logger: Logger
onMessageNotification: Subject<AgentAssistBaseResponse> = ...
onVoiceTranscriptionError: Subject<AgentAssistErrorResponse> = ...
onVoiceTranscriptionMessage: Subject<VoiceTranscriptionResponse> = ...
reconnectAttemptSource: "fromOnError" | "fromOnClosed" = null
subscriptionTopics: Set<string> = ...
subscriptions: string[] = []
webSocketUri: string = ''
wssWorker: any

Methods

  • addSubscriptionTopics(subscriptions: string[], isAgenticWs: boolean): void
  • Adds default subscriptions for agent copilot, and any additional passed subscriptions. When the AGENTIC_WEBSOCKET toggle is ON the agenticWssWorker owns the copilot topics, so they are skipped on the old worker.

    example
    • addSubscriptionTopics([]);

    Parameters

    • subscriptions: string[]
    • isAgenticWs: boolean

    Returns void

  • broadcastCopilotNotifications(message: any): void
  • close(): void
  • connect(websocketServerUri: string, agentId: string, agentCopilotInput?: AgentAssistInput): boolean
  • disconnectWebsocket(): void
  • getAgenticWebSocketUrl(): Promise<string>
  • handleHeartbeatAckFor(state: HeartbeatMonitorState, label: string): void
  • Marks a HEARTBEAT_ACK as received for the given state and resets the miss counter.

    example
    • handleHeartbeatAckFor(this.heartbeatState, 'Heartbeat')

    Parameters

    • state: HeartbeatMonitorState

      mutable heartbeat state to update

    • label: string

      log label used in the info message

    Returns void

  • initAgenticWorker(): Promise<void>
  • initLogger(providerId: string): void
  • initWebSocketWorker(providerId: string): void
  • isAgenticWsEnabled(): boolean
  • isHeartbeatMonitorEnabled(): boolean
  • onAgenticWorkerMessage(response: MessageEvent<any>): void
  • onClosed(): boolean
  • onError(): void
  • onMessage(message: unknown, source?: MessageSource): void
  • onOpen(): void
  • onReconnect(): void
  • onReconnectComplete(): void
  • onReconnectSuccess(): void
  • reconnectWebsocket(): void
  • scheduleAgenticReconnect(): void
  • sendMessage(msg: unknown, wsWorker: any): void
  • startHeartbeatMonitorFor(state: HeartbeatMonitorState, interval: number, label: string, onThreshold: (() => void)): void
  • Starts a heartbeat monitor for the given state object. After HEARTBEAT_MISS_THRESHOLD consecutive missed acknowledgments, stops the monitor and calls onThreshold to trigger the appropriate reconnect action.

    example
    • startHeartbeatMonitorFor(this.heartbeatState, HEARTBEAT_INTERVAL, 'Heartbeat', this.onClosed())

    Parameters

    • state: HeartbeatMonitorState

      mutable heartbeat state (timer, ackReceived, missCount)

    • interval: number

      polling interval in milliseconds

    • label: string

      log label used in warn/info messages

    • onThreshold: (() => void)

      callback invoked when miss threshold is reached

        • (): void
        • Returns void

    Returns void

  • stopHeartbeatMonitorFor(state: HeartbeatMonitorState): void
  • subscribeAgenticTopics(): void
  • Sends SUBSCRIBE frames for the two agentic copilot topics to the agentic worker. Called on the worker's 'open' event. Each frame carries the current access token as headers.sessionToken — the agentic gateway requires it for re-authorisation on every command, not just the initial handshake. Also pushes the fresh token into the worker so subsequent HEARTBEAT frames generated inside the worker pick up the latest credential.

    example
    • subscribeAgenticTopics('12345')

    Returns void

  • subscribeToSocket(topic: string): boolean
  • terminateAgenticWorker(): void
  • terminateWebSocketWorker(): void
  • unsubscribe(topic: string): boolean

Generated using TypeDoc