import * as core from "../../../../core/index.js"; import type * as SarvamAI from "../../../index.js"; export declare namespace SpeechToTextStreamingSocket { interface Args { socket: core.ReconnectingWebSocket; } type Response = SarvamAI.SpeechToTextStreamingResponse; type EventHandlers = { open?: () => void; message?: (message: Response) => void; close?: (event: core.CloseEvent) => void; error?: (error: Error) => void; }; } export declare class SpeechToTextStreamingSocket { readonly socket: core.ReconnectingWebSocket; protected readonly eventHandlers: SpeechToTextStreamingSocket.EventHandlers; private handleOpen; private handleMessage; private handleClose; private handleError; constructor(args: SpeechToTextStreamingSocket.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: SpeechToTextStreamingSocket.EventHandlers[T]): void; /** @param params - Object containing audio (base64), sample_rate, and encoding*/ transcribe(params: { audio: string; sample_rate?: number; encoding?: string; }): void; sendConfigMessage(message: SarvamAI.ConfigMessage): void; /** Signal to flush the audio buffer and force finalize partial transcriptions */ flush(): void; /** Connect to the websocket and register event handlers. */ connect(): SpeechToTextStreamingSocket; /** 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.AudioMessage | SarvamAI.SttFlushSignal): void; }