|
@@ -1 +1,36 @@
|
1
|
|
-export {};
|
|
1
|
+import { readyStateCallback, callback } from './callback';
|
|
2
|
+/**
|
|
3
|
+ * Client ws client, 单例模式, 负责维护连接
|
|
4
|
+ */
|
|
5
|
+export declare class Client {
|
|
6
|
+ callback: callback;
|
|
7
|
+ requestHeader: string;
|
|
8
|
+ responseHeader: string;
|
|
9
|
+ maxPayload: number;
|
|
10
|
+ url: string;
|
|
11
|
+ reconnectTimes: number;
|
|
12
|
+ reconnectLock: boolean;
|
|
13
|
+ socket: WebSocket;
|
|
14
|
+ readyStateCallback: readyStateCallback;
|
|
15
|
+ constructor(url: string, readyStateCallback: readyStateCallback);
|
|
16
|
+ ping(param?: {}, callback?: {}): void;
|
|
17
|
+ send(data: any): void;
|
|
18
|
+ /**
|
|
19
|
+ * asyncSend
|
|
20
|
+ * @param {*} operator
|
|
21
|
+ * @param {*} param
|
|
22
|
+ * @param {*} callback 仅此次有效的callback
|
|
23
|
+ */
|
|
24
|
+ asyncSend(operator: any, param: any, callback: any): void;
|
|
25
|
+ syncSend(operator: any, param: any, callback: any): Promise<void>;
|
|
26
|
+ addMessageListener(operator: any, listener: any): void;
|
|
27
|
+ removeMessageListener(operator: any): void;
|
|
28
|
+ getReadyState(): number;
|
|
29
|
+ setMaxPayload(maxPayload: any): void;
|
|
30
|
+ setRequestProperty(key: any, value: any): void;
|
|
31
|
+ getRequestProperty(key: any): string;
|
|
32
|
+ setResponseProperty(key: any, value: any): void;
|
|
33
|
+ getResponseProperty(key: any): string;
|
|
34
|
+ connect(): WebSocket;
|
|
35
|
+ reconnect(): void;
|
|
36
|
+}
|