UNPKG

@fairmint/canton-node-sdk

Version:
28 lines 1.07 kB
import { type BaseClient } from '../BaseClient'; export interface WebSocketSubscription { close: () => void; isConnected: () => boolean; getConnectionState: () => number; } export interface WebSocketHandlers<Message, ErrorMessage = unknown> { onOpen?: () => void; onMessage: (msg: Message) => void; onError?: (err: Error | ErrorMessage) => void; onClose?: (code: number, reason: string) => void; } /** * Minimal WebSocket helper that: * * - Upgrades http(s) URL to ws(s) * - Auth via Authorization header (standard approach) * - Uses 'daml-ledger-api' subprotocol * - Sends an initial request message * - Dispatches parsed messages to user handlers */ export declare class WebSocketClient { private readonly client; constructor(client: BaseClient); connect<RequestMessage, InboundMessage, ErrorMessage = unknown>(path: string, requestMessage: RequestMessage, handlers: WebSocketHandlers<InboundMessage, ErrorMessage>): Promise<WebSocketSubscription>; private buildWsUrl; } //# sourceMappingURL=WebSocketClient.d.ts.map