import { Logger } from './logger'; /** * Possible connection states for the LiveKit client */ export declare enum ConnectionState { /** Not connected to any room */ DISCONNECTED = "disconnected", /** Currently attempting to connect */ CONNECTING = "connecting", /** Successfully connected to a room */ CONNECTED = "connected", /** Connection was lost and attempting to reconnect */ RECONNECTING = "reconnecting", /** Connection failed and not attempting to reconnect */ FAILED = "failed" } /** * Possible connection events that can trigger state transitions */ export declare enum ConnectionEvent { /** Attempt to connect to a room */ CONNECT = "connect", /** Successfully connected to a room */ CONNECTED = "connected", /** Connection was lost */ DISCONNECTED = "disconnected", /** Attempting to reconnect */ RECONNECT = "reconnect", /** Successfully reconnected */ RECONNECTED = "reconnected", /** Failed to connect or reconnect */ FAILED = "failed", /** Manually disconnect from a room */ DISCONNECT = "disconnect" } /** * Configuration for the connection state machine */ export interface ConnectionStateMachineConfig { /** Initial state (default: DISCONNECTED) */ initialState?: ConnectionState; /** Logger instance */ logger?: Logger; } /** * Type for state transition handlers */ export type StateTransitionHandler = (from: ConnectionState, to: ConnectionState, event: ConnectionEvent) => void; /** * Manages connection state transitions with a proper state machine */ export declare class ConnectionStateMachine { private currentState; private logger; private transitionHandlers; /** * Creates a new connection state machine * @param config Configuration options */ constructor(config?: ConnectionStateMachineConfig); /** * Gets the current connection state * @returns The current connection state */ getState(): ConnectionState; /** * Checks if the current state matches the given state * @param state The state to check against * @returns True if the current state matches */ isInState(state: ConnectionState): boolean; /** * Adds a handler for state transitions * @param handler The handler function * @returns This instance for chaining */ onTransition(handler: StateTransitionHandler): this; /** * Handles a connection event and performs the appropriate state transition * @param event The connection event * @returns True if a state transition occurred */ handleEvent(event: ConnectionEvent): boolean; }