import type { BackendSocket, BackendTransport, ControlTransport, RuntimeTransport } from './types.js'; import { type WebSocketHandshakeState } from './Lifecycle.js'; export declare class HttpControlTransport implements ControlTransport { private readonly baseUrl; private readonly ticket; private readonly userId?; private readonly fetchImpl; constructor(baseUrl: string, ticket: string | (() => Promise), userId?: string | undefined, fetchImpl?: typeof fetch); request(method: string, payload?: any, options?: { signal?: AbortSignal; }): Promise; stream(method: string, payload?: unknown, options?: { signal?: AbortSignal; }): AsyncGenerator; } export declare class HttpBackendTransport implements BackendTransport { private readonly baseUrl; private readonly gameId; private readonly getTicket; private readonly userId?; constructor(baseUrl: string, gameId: string, getTicket: () => Promise, userId?: string | undefined); request(path: string, options?: { method?: string; body?: unknown; headers?: Record; signal?: AbortSignal; }): Promise<{ status: number; data: any; headers: Headers; }>; connect(path: string, options?: { protocols?: string[]; signal?: AbortSignal; }): Promise; } export declare class WebSocketRuntimeTransport implements RuntimeTransport { private readonly url; private readonly ticket; private readonly WebSocketImpl; private readonly fetchImpl; private readonly handshakeTimeoutMs; private socket; private generation; private cancelPending?; private listener?; private stateListener?; private handshakeLifecycle; constructor(url: string, ticket: string | (() => Promise), WebSocketImpl?: typeof WebSocket, fetchImpl?: typeof fetch, handshakeTimeoutMs?: number); get handshakeState(): WebSocketHandshakeState; get handshakeHistory(): { from: WebSocketHandshakeState; event: import("./Lifecycle.js").WebSocketHandshakeEvent; to: WebSocketHandshakeState; }[]; onMessage(handler: (message: unknown) => void): () => void; onState(handler: (state: string) => void): () => void; connect({ instanceId, lastServerSeq }: { instanceId: string; lastServerSeq: number; }): Promise; /** * Classifies a failed handshake by asking the control plane whether the base * URL is a Runtime at all. A game loaded from an asset CDN falls back to its * page origin, which turned a routing mistake into an opaque "connection * failed"; this probe makes that visible. */ private describeHandshakeFailure; send(message: unknown): Promise; disconnect(): Promise; }