/** * let ws = new TqWebsocket(url, options) * PARAMS: * url [string | array] * options [object] * { reconnectInterval, -- 重连时间间隔 * reconnectMaxTimes -- 重连最大次数 * } * * METHODS: * ws.init() * ws.on(eventName, (data) => {......}) * eventName = * ['message', -- 收到信息 * 'open', -- 连接建立 * 'reconnect', -- 重新开始建立连接 * 'close', -- 某个连接关闭 * 'error', -- 某个连接报错 * 'death' -- 不再重连 * ] * ws.send( [obj | string] ) * ws.close() */ export class TqWebsocket extends EventEmitter { constructor(url: any, options?: {}); urlList: any[]; ws: any; queue: any[]; reconnect: boolean; reconnectTask: any; reconnectInterval: any; reconnectMaxTimes: any; WebSocket: any; reconnectTimes: number; reconnectUrlIndex: number; STATUS: { CONNECTING: number; OPEN: number; CLOSING: number; CLOSED: number; }; send(obj: any): void; isReady(): boolean; __init(isReconnection?: boolean): void; close(): void; } export class TqTradeWebsocket extends TqWebsocket { constructor(url: any, dm: any, options?: {}); dm: any; req_login: any; init(): void; _separateNotifies(data: any): any[]; } export class TqQuoteWebsocket extends TqWebsocket { constructor(url: any, dm: any, options?: {}); dm: any; subscribe_quote: any; charts: {}; init(): void; } export class TqRecvOnlyWebsocket extends TqWebsocket { constructor(url: any, dm: any, options?: {}); dm: any; init(): void; } import EventEmitter from "eventemitter3";