Class: WebSocketClient
@kortexya/reasoninglayer / WebSocketClient
Class: WebSocketClient
Section titled “Class: WebSocketClient”Defined in: src/websocket.ts:221
WebSocket client for real-time event subscriptions.
Remarks
Section titled “Remarks”Dependency rule: imports ONLY from config.ts + errors.ts (same level as http.ts).
Constructs WebSocket URLs from the base HTTP URL by replacing the protocol
(http -> ws, https -> wss) and appending the tenant ID as a query parameter.
Example
Section titled “Example”const wsClient = new WebSocketClient(resolvedConfig);const conn = wsClient.connect('/api/v1/cognitive/agents/events', { agent_id: 'some-uuid',});conn.onMessage((event) => console.log(event));// ... laterconn.close();Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WebSocketClient(
config):WebSocketClient
Defined in: src/websocket.ts:224
Parameters
Section titled “Parameters”config
Section titled “config”ResolvedConfig
Returns
Section titled “Returns”WebSocketClient
Methods
Section titled “Methods”connect()
Section titled “connect()”connect(
path,params?):WebSocketConnection
Defined in: src/websocket.ts:235
Open a WebSocket connection to the given path.
Parameters
Section titled “Parameters”string
API path (e.g., /api/v1/cognitive/agents/events).
params?
Section titled “params?”Record<string, string>
Additional query parameters (appended after tenant_id).
Returns
Section titled “Returns”A new WebSocketConnection with auto-reconnect.