setupAgenticWSHandlers
@nuclia/core • Docs
@nuclia/core / setupAgenticWSHandlers
Function: setupAgenticWSHandlers()
setupAgenticWSHandlers(
ws,message,subject,onUnexpectedClose?,closeOnDone?):void
Sets up the onopen / onmessage / onerror / onclose handlers on an already-created WebSocket.
Shared by RetrievalAgent._interactThroughWs() and KnowledgeBox.asViaWS().
Both callers own the Subject and the WebSocket; this function only wires the handlers.
Parameters
• ws: WebSocket
The WebSocket instance to attach handlers to.
• message: InteractionRequest
The initial message sent on open.
• subject: Subject<IErrorResponse | AragResponse>
The Subject that receives parsed AragAnswer emissions.
• onUnexpectedClose?
Called when the socket closes with a non-1000 code before receiving a DONE operation. The caller decides whether to reconnect (RetrievalAgent) or emit an error and complete (KnowledgeBox).
• closeOnDone?: boolean = true
Returns
void
Defined in
libs/sdk-core/src/lib/db/retrieval-agent/agentic-websocket.ts:24