import * as core from "../../../../core/index.js"; import type * as SarvamAI from "../../../index.js"; export declare namespace SpeechToTextRealtimeStreamingSocket { interface Args { socket: core.ReconnectingWebSocket; } type Response = SarvamAI.RealtimeSessionBegin | SarvamAI.RealtimeVadSpeechStart | SarvamAI.RealtimeVadSpeechEnd | SarvamAI.RealtimeTranscriptPartial | SarvamAI.RealtimeTranscriptFinal | SarvamAI.RealtimeConfigUpdated | SarvamAI.RealtimePong | SarvamAI.RealtimeSessionEnd | SarvamAI.RealtimeError; type EventHandlers = { open?: () => void; message?: (message: Response) => void; close?: (event: core.CloseEvent) => void; error?: (error: Error) => void; }; } export declare class SpeechToTextRealtimeStreamingSocket { readonly socket: core.ReconnectingWebSocket; protected readonly eventHandlers: SpeechToTextRealtimeStreamingSocket.EventHandlers; private handleOpen; private handleMessage; private handleClose; private handleError; constructor(args: SpeechToTextRealtimeStreamingSocket.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: SpeechToTextRealtimeStreamingSocket.EventHandlers[T]): void; sendRealtimeAudioInput(message: SarvamAI.RealtimeAudioInput): void; sendRealtimeSpeechStart(message: SarvamAI.RealtimeSpeechStart): void; sendRealtimeSpeechEnd(message: SarvamAI.RealtimeSpeechEnd): void; sendRealtimeFlush(message: SarvamAI.RealtimeFlush): void; sendRealtimeConfigUpdate(message: SarvamAI.RealtimeConfigUpdate): void; sendRealtimeEnd(message: SarvamAI.RealtimeEnd): void; sendRealtimePing(message: SarvamAI.RealtimePing): void; /** Connect to the websocket and register event handlers. */ connect(): SpeechToTextRealtimeStreamingSocket; /** 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.RealtimeAudioInput | SarvamAI.RealtimeSpeechStart | SarvamAI.RealtimeSpeechEnd | SarvamAI.RealtimeFlush | SarvamAI.RealtimeConfigUpdate | SarvamAI.RealtimeEnd | SarvamAI.RealtimePing): void; }