import * as core from "../../../../core/index.mjs"; import type * as SarvamAI from "../../../index.mjs"; export declare namespace VoiceCloningStreamingSocket { interface Args { socket: core.ReconnectingWebSocket; } type Response = SarvamAI.AudioOutput | SarvamAI.EventResponse | SarvamAI.ErrorResponse; type EventHandlers = { open?: () => void; message?: (message: Response) => void; close?: (event: core.CloseEvent) => void; error?: (error: Error) => void; }; } export declare class VoiceCloningStreamingSocket { readonly socket: core.ReconnectingWebSocket; protected readonly eventHandlers: VoiceCloningStreamingSocket.EventHandlers; private handleOpen; private handleMessage; private handleClose; private handleError; constructor(args: VoiceCloningStreamingSocket.Args); /** The current state of the connection; this is one of the readyState constants. */ get readyState(): number; /** * @param event - The event to attach to. * @param callback - The callback to run when the event is triggered. * Usage: * ```typescript * this.on('open', () => { * console.log('The websocket is open'); * }); * ``` */ on(event: T, callback: VoiceCloningStreamingSocket.EventHandlers[T]): void; configure(message: SarvamAI.VoiceCloningConfigureConnection): void; convert(message: SarvamAI.VoiceCloningSendText): void; flush(message: SarvamAI.FlushSignal): void; ping(message: SarvamAI.PingSignal): void; /** Connect to the websocket and register event handlers. */ connect(): VoiceCloningStreamingSocket; /** Close the websocket and unregister event handlers. */ close(): void; /** Returns a promise that resolves when the websocket is open. */ waitForOpen(): Promise; /** Asserts that the websocket is open. */ private assertSocketIsOpen; /** Send a binary payload to the websocket. */ protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void; /** Send a JSON payload to the websocket. */ protected sendJson(payload: SarvamAI.VoiceCloningConfigureConnection | SarvamAI.VoiceCloningSendText | SarvamAI.FlushSignal | SarvamAI.PingSignal): void; }