UNPKG

1.4 kBTypeScriptView Raw
1import { Message } from './user/mod';
2import Peer from 'json-rpc-peer';
3import { Wechaty } from './wechaty';
4export interface IoOptions {
5 wechaty: Wechaty;
6 token: string;
7 apihost?: string;
8 protocol?: string;
9 servicePort?: number;
10}
11export declare const IO_EVENT_DICT: {
12 botie: string;
13 error: string;
14 heartbeat: string;
15 jsonrpc: string;
16 login: string;
17 logout: string;
18 message: string;
19 raw: string;
20 reset: string;
21 scan: string;
22 shutdown: string;
23 sys: string;
24 update: string;
25};
26export declare class Io {
27 private options;
28 private readonly id;
29 private readonly protocol;
30 private eventBuffer;
31 private ws;
32 private readonly state;
33 private reconnectTimer?;
34 private reconnectTimeout?;
35 private lifeTimer?;
36 private onMessage;
37 private scanPayload?;
38 protected jsonRpc?: Peer;
39 constructor(options: IoOptions);
40 toString(): string;
41 private connected;
42 start(): Promise<void>;
43 private initEventHook;
44 private initWebSocket;
45 private wsOnOpen;
46 private wsOnMessage;
47 private wsOnError;
48 private wsOnClose;
49 private reconnect;
50 private send;
51 stop(): Promise<void>;
52 /**
53 *
54 * Prepare to be overwritten by server setting
55 *
56 */
57 private ioMessage;
58 protected syncMessage(m: Message): Promise<void>;
59}
60//# sourceMappingURL=io.d.ts.map
\No newline at end of file