import { Application } from './Application';
/**
 * WebSocketClient hostname 修复函数类型
 * 允许外部环境（如 Electron desktop）提供自定义的 hostname 修复逻辑
 *
 * @param hostname - 原始 hostname
 * @returns 修复后的 hostname，如果返回 null/undefined 或非字符串值，则使用原值
 */
type HostnameFixer = (hostname: string) => string | null | undefined;
declare global {
    interface Window {
        /**
         * WebSocketClient hostname 修复函数（可选）
         * 由特定环境（如 Electron desktop preload 脚本）提供
         * 用于在生成 WebSocket URL 时修复 hostname
         */
        __tachybase_fix_websocket_hostname__?: HostnameFixer;
    }
}
export type WebSocketClientOptions = {
    reconnectInterval?: number;
    reconnectAttempts?: number;
    pingInterval?: number;
    url?: string;
    basename?: string;
    protocols?: string | string[];
    onServerDown?: any;
};
export declare class WebSocketClient {
    private app;
    protected _ws: WebSocket;
    protected _reconnectTimes: number;
    protected events: any[];
    protected options: WebSocketClientOptions;
    enabled: boolean;
    connected: boolean;
    serverDown: boolean;
    lastMessage: {};
    constructor(options: WebSocketClientOptions | boolean, app: Application);
    getURL(): string;
    get reconnectAttempts(): number;
    get reconnectInterval(): number;
    get pingInterval(): number;
    get readyState(): number;
    connect(): void;
    reconnect(): void;
    close(): void;
    send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
    on(type: string, listener: any, options?: boolean | AddEventListenerOptions): void;
    emit(type: string, args: any): void;
    off(type: string, listener: any, options?: boolean | EventListenerOptions): void;
    removeAllListeners(): void;
}
export {};
