/// import { ConnectionConfig, ConnectionConfigFull } from '../config/connection'; import { RealtimeSocketHandler } from './handlers'; import { RecognitionStarted, SessionConfig } from '../types'; import { EventMap } from '../types/event-map'; /** * A class that represents a single realtime session. It's responsible for handling the connection and the messages. * * @param config - An apiKey string or an object of type ConnectionConfig. If only the string is provided, then the default ConnectionConfig will be used with this apiKey. * */ export declare class RealtimeSession { connectionConfig: ConnectionConfigFull; private emitter; rtSocketHandler: RealtimeSocketHandler; constructor(config: string | ConnectionConfig); private bindHandlers; /** * Adds a listener for the specified event. * * @param event - The event to listen for. Should be one of the RealtimeMessageMessageEnum values. * @param listener - The callback function that will be called when the event is emitted. */ addListener( event: MessagesEnum, listener: EventMap[MessagesEnum], ): void; /** * Removes a listener for the specified event. * * @param event - The event to remove the listener from. Should be one of the RealtimeMessageMessageEnum values. * @param listener - The callback function that will be removed. */ removeListener( event: MessagesEnum, listener: EventMap[MessagesEnum], ): void; /** * Starts the realtime transcription session. * * @param transcriptionConfig - The config for the transcription. If not provided, the default options from the config will be used. * @param audioFormat - The audio format of the audio data that will be sent to the server. If not provided, the default audio format from the config will be used. * @returns Promise that resolves when the session is started. */ start(config?: SessionConfig): Promise; /** * Stops the realtime transcription session. * * @returns Promise that resolves when the session is stopped. */ stop(): Promise; /** * Sends audio data to the server. * * @param data - The audio data to send to the server. Should be a Float32Array. PCM audio. */ sendAudio(data: Float32Array | Buffer | Blob): void; /** * Checks if the session is connected to the server. * * @returns True if the session is connected to the server, false otherwise. */ isConnected(): boolean; }