/**
 * ws (WebSocket) shim for browser environment
 * Used by Vite for HMR (Hot Module Replacement)
 */
import { EventEmitter } from './events';
export declare class WebSocket extends EventEmitter {
    static readonly CONNECTING = 0;
    static readonly OPEN = 1;
    static readonly CLOSING = 2;
    static readonly CLOSED = 3;
    readonly CONNECTING = 0;
    readonly OPEN = 1;
    readonly CLOSING = 2;
    readonly CLOSED = 3;
    readyState: number;
    url: string;
    protocol: string;
    extensions: string;
    bufferedAmount: number;
    binaryType: 'blob' | 'arraybuffer';
    private _id;
    private _requestedProtocols?;
    private _server;
    private _nativeWs;
    private readonly _channelName;
    private _channel;
    onopen: ((event: Event) => void) | null;
    onclose: ((event: CloseEvent) => void) | null;
    onerror: ((event: Event) => void) | null;
    onmessage: ((event: MessageEvent) => void) | null;
    constructor(url: string, protocols?: string | string[], channelName?: string);
    private _connect;
    private _connectNative;
    send(data: string | ArrayBuffer | Uint8Array): void;
    close(code?: number, reason?: string): void;
    ping(): void;
    pong(): void;
    terminate(): void;
    _setServer(server: WebSocketServer): void;
    _receiveMessage(data: unknown): void;
}
export interface ServerOptions {
    host?: string;
    port?: number;
    server?: unknown;
    noServer?: boolean;
    path?: string;
    clientTracking?: boolean;
    perMessageDeflate?: boolean | object;
    maxPayload?: number;
}
export declare class WebSocketServer extends EventEmitter {
    clients: Set<WebSocket>;
    options: ServerOptions;
    private _path;
    private readonly _channelName;
    private _channel;
    private _channelHandler;
    constructor(options?: ServerOptions, channelName?: string);
    private _setupListener;
    _handleClientMessage(client: WebSocket, data: unknown): void;
    handleUpgrade(request: unknown, socket: unknown, head: unknown, callback: (ws: WebSocket, request: unknown) => void): void;
    close(callback?: () => void): void;
    address(): {
        port: number;
        family: string;
        address: string;
    } | null;
}
export default WebSocket;
export declare const Server: typeof WebSocketServer;
export declare const createWebSocketStream: () => never;
/**
 * Per-runtime ws module whose BroadcastChannel transport is scoped to the
 * owning container. Servers and clients created inside one container only
 * see each other; the page-wide legacy channel let any container's server
 * claim any container's client connect.
 */
export declare function createWsModule(ownerId: string): Record<string, unknown>;
//# sourceMappingURL=ws.d.ts.map