import type { LogFunc, RequestHeader } from './common'; export declare enum SocketError { PING_PONG_ERROR = 3001, EXCEED_MAX_COUNT = 3002 } export declare enum SocketChannelType { all = "ALL", chat = "CHAT", notification = "NOTIFICATION", product = "PRODUCT" } /** * @description WebSocket 配置 */ export interface WebSocketConfigModel { wsId: string; address: string; } /** * @description WebSocket URL 配置 */ export interface SocketURLConfig { socketPath: string; socketCheckPath: string; channel: SocketChannelType[]; } /** * @description WebSocket onError 生命周期自定义事件 */ export interface ErrorEvent extends CloseEvent { subCode?: string; subCodeReason?: string; subCodeActions?: string[]; } /** * @description WebSocket 生命周期 */ export interface WebSocketLifeCycle { onOpen?: (ev: Event, webSocket?: WebSocket) => void; onClose?: (ev: CloseEvent, webSocket?: WebSocket) => void; onError?: (ev: CloseEvent, webSocket?: WebSocket) => void; onMessage?: (message: SocketMessageInterface) => void; } /** * Socket 对象配置参数 */ export interface SocketConfig { baseUrl: string; header: RequestHeader; urlConfig: SocketURLConfig; lifeCycle?: WebSocketLifeCycle; APIVersion: string; refUserId: string; log?: LogFunc; } /** Socket 消息相关 */ /** * 消息类型 */ export declare enum WS_MSG_TYPE { cmd = "cmd",// 预留 ack = "ack", notice = "notice",// 服务端业务通知链路 ping = "ping",// ping 出去 pong = "pong" } /** * Socket 层的需要关心的参数 */ export interface SocketMessageInterface { seqId?: string; type: string; wsId?: string; } export declare const SDK_VERSION = "1.0.0"; export declare const MAX_SOCKET_RETRY_COUNT = 5; export declare const PING_MAX_COUNT = 2;