Browse Source

define const

Paul 5 years ago
parent
commit
58c32f20f5
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      src/index.ts

+ 6
- 2
src/index.ts View File

35
       throw new Error('asyncSend: connection refuse');
35
       throw new Error('asyncSend: connection refuse');
36
     }
36
     }
37
 
37
 
38
+    const heartbeatOperator = 0;
39
+
38
     this.listeners.set(
40
     this.listeners.set(
39
-      0,
41
+      heartbeatOperator,
40
       (data: string): void => {
42
       (data: string): void => {
41
         const code = this.getResponseProperty('code');
43
         const code = this.getResponseProperty('code');
42
         if (code !== '') {
44
         if (code !== '') {
51
     );
53
     );
52
 
54
 
53
     const p = new Packet();
55
     const p = new Packet();
54
-    this.send(p.pack(0, 0, this.requestHeader, JSON.stringify(param)));
56
+    this.send(
57
+      p.pack(heartbeatOperator, 0, this.requestHeader, JSON.stringify(param)),
58
+    );
55
   }
59
   }
56
 
60
 
57
   send(data: ArrayBuffer) {
61
   send(data: ArrayBuffer) {