import Socket, { SocketConfig } from "../../common/socket";
import type { RequestData, ResponseData } from "../model-api";
import type { NotificationCallback } from "./types";
import { UNITY_SOCKET_EVENT } from "./enums";
type EventNames = keyof typeof UNITY_SOCKET_EVENT;
/**
 * Websocket 的通知消息、响应消息数据结构，需要查阅 Model API 对应的开发文档
 * @see https://docs.qq.com/doc/DRmFKQ0RYUE91TmVq
 */
export declare class UnitySocket extends Socket {
    /**
     * @description 响应 Promise 的 `resolve/reject` 映射
     */
    private promiseHandlers;
    /**
     * @description 通知消息的监听器集合
     */
    private notificationListeners;
    private flushQueue;
    constructor(config: SocketConfig);
    /**
     * @description 派发通知消息
     * @param data 消息的数据
     */
    private dispatchNotification;
    /**
     * @description 派发响应消息
     * @param response 响应消息
     */
    private dispatchResponse;
    /**
     * @description `message` 事件派发
     * @param res 响应的字符串内容
     */
    private dispatchMessage;
    send(data: Object | string): void;
    /**
     * @description 连接服务端
     */
    connect(): void;
    /**
     * @description 发送一个请求
     * @param type 请求的类型
     * @param data 请求的数据
     */
    invoke<T extends keyof (RequestData | ResponseData), D = RequestData[T] | Record<string, any>, R = ResponseData[T] | any>(type: T | string, data?: D): Promise<R>;
    /**
     * @description 添加通知消息的监听器
     * @param callback 监听器
     * @returns 移除该监听的函数
     */
    addNotificationListener(type: string, callback: NotificationCallback): () => void;
    /**
     * @description 移除通知消息的监听器
     * @param callback 已注册的监听器
     * @returns 是否移除成功
     */
    removeNotificationListener(type: string, callback?: NotificationCallback): true | undefined;
    emit<T extends EventNames>(type: T, ...args: any[]): void;
    addListener<T extends EventNames>(event: T, listener: Function): this;
    removeListener<T extends EventNames>(event: T, listener: Function): void;
    removeAllListener<T extends EventNames>(event?: T): void;
    once<T extends EventNames>(event: T, listener: Function): this;
    /**
     * @description 断开连接
     * - 等价于 `close` 方法
     */
    disconnect(): void;
}
export {};
