/**
 * @file lib/Server
 * @description ws服务逻辑处理
 * @author zhangyue49
 */
import { type WebSocketClient } from '@bddh/starling-web-socket/es/interface';
import { CallbackMsgType, ConnectDataType, ConnectParamsType } from './interface';
export interface SteamDataType {
    first: boolean;
    last: boolean;
    audio?: string;
    body?: string;
}
export interface DHServerInterface {
    action: string;
    requestId: string;
    clientTs: number;
    body: string | ArrayBuffer;
}
export interface DHErrServerInterface {
    action: string;
    requestId: string;
    code?: number;
    message?: string;
    error: Error;
}
type ConnectListener = (data: ConnectDataType, off?: () => void) => void;
export interface createSocketParamsType {
    token?: string;
    appKey?: string;
    appId?: string;
    sessionId?: string;
    parameters?: ConnectParamsType;
    reConnect?: boolean;
    onConnect?: ConnectListener;
    onDigitalHumanCallback?: (data: CallbackMsgType) => void;
}
export interface RenderCallbackRes {
    requestId: string;
    action: string;
    code: number;
    body: string | null;
    message: string;
}
interface ServerOptions {
    checkHeartbeatMismatch?: boolean;
    emitRawStatusMessage?: boolean;
}
export type RenderCallback = (res: RenderCallbackRes) => void;
export declare const CONNECTING_STUCK_MS_DEFAULT: number;
declare class Server {
    dhServerSocket: WebSocketClient | null;
    preConnectSuccess: boolean;
    connectParams: createSocketParamsType | null;
    private socketClosingPromise;
    private readonly url;
    private firstConnect;
    private connectingTimer;
    private readonly connectingMs;
    private lastPreOpen;
    private reconnectingTimeout;
    private lastReportedReadyState;
    private lastHbAckTs;
    private readonly checkHeartbeatMismatch;
    private emitRawStatusMessage;
    constructor(url: string, options?: ServerOptions);
    setEmitRawStatusMessage(value: boolean): void;
    sendPreConnect: (props: createSocketParamsType, resolve?: ((value: any) => void) | undefined) => void;
    createSocket: (props: createSocketParamsType, isPreOpenSession?: boolean) => Promise<WebSocketClient | null>;
    sendConnect: (props: createSocketParamsType) => void;
    closeSocket: () => Promise<void>;
    handleConnect: () => Promise<void>;
    sendMessage(message: DHServerInterface | ArrayBuffer, listener: RenderCallback | null): Promise<void>;
    private startConnectingWatch;
    private clearConnectingWatch;
    private resetState;
}
export default Server;
