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,8 +35,10 @@ class Client {
35 35
       throw new Error('asyncSend: connection refuse');
36 36
     }
37 37
 
38
+    const heartbeatOperator = 0;
39
+
38 40
     this.listeners.set(
39
-      0,
41
+      heartbeatOperator,
40 42
       (data: string): void => {
41 43
         const code = this.getResponseProperty('code');
42 44
         if (code !== '') {
@@ -51,7 +53,9 @@ class Client {
51 53
     );
52 54
 
53 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 61
   send(data: ArrayBuffer) {