
export interface CustomeSocket<S> {
  connect?: (url: string) => void;
  send: (data: S) => void;
  close: () => void;
  addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
  removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener?: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
}

export interface SocketSettings {
  retryLimit?: number;
  heartData?: any;
  heartInterval?: number;  
  baseUrl: string;
}

export type ConnectStatus = 'ready' | 'opening' | 'onerror' | 'closed' | 'reconnect';

export type AnyRemoteMainFlag = 'Heart' | 'Login' | 'Broadcast' | 'Home' | 'CallOffer' | 'CallAnswer' | 'ChannelChat' | 'NotifyUpdateUserList' | 'SetAtts' | 'Login';
export type AnyRemoteSubFlag = 'Request' | 'Busying' | 'Connect' | 'Hangup' | 'UpdateUserList' | 'OtherLoginIn' | 'NoDevice';

export interface AnyRemoteSocketMessage {
  fromID?: string;
  fromName?: string;
  avatar?: string;
  permission?: string;
  msgMainFlag: AnyRemoteMainFlag;
  msgSubFlag?: AnyRemoteSubFlag;
  msgData?: any;
  UserAtts?: any;
  toID: string;
  toName?: string;
  channelID?: string;
}