@nmtjs/ws-client 0.12.9 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +6 -3
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -29,9 +29,12 @@ export class WebSocketClientTransport extends ProtocolTransport {
29
29
  this.protocol.handleServerMessage(data, this, transformer);
30
30
  });
31
31
  ws.addEventListener('close', (event) => {
32
- console.log(`WebSocket closed — Code: ${event.code}; Reason: ${event.reason}`);
33
32
  this.status = ProtocolTransportStatus.DISCONNECTED;
34
- this.emit('disconnected');
33
+ this.emit('disconnected', event.code === 1000
34
+ ? event.reason === 'client'
35
+ ? 'client'
36
+ : 'server'
37
+ : 'error');
35
38
  this.webSocket = null;
36
39
  }, { once: true });
37
40
  this.webSocket = ws;
@@ -50,7 +53,7 @@ export class WebSocketClientTransport extends ProtocolTransport {
50
53
  async disconnect() {
51
54
  if (this.webSocket === null)
52
55
  return;
53
- this.webSocket.close(1000, 'user');
56
+ this.webSocket.close(1000, 'client');
54
57
  return _once(this.webSocket, 'close');
55
58
  }
56
59
  async call(namespace, procedure, payload, options, transformer) {
package/package.json CHANGED
@@ -9,21 +9,21 @@
9
9
  }
10
10
  },
11
11
  "dependencies": {
12
- "@nmtjs/client": "0.12.9",
13
- "@nmtjs/common": "0.12.9",
14
- "@nmtjs/protocol": "0.12.9"
12
+ "@nmtjs/client": "0.13.0",
13
+ "@nmtjs/common": "0.13.0",
14
+ "@nmtjs/protocol": "0.13.0"
15
15
  },
16
16
  "peerDependencies": {
17
- "@nmtjs/client": "0.12.9",
18
- "@nmtjs/common": "0.12.9",
19
- "@nmtjs/protocol": "0.12.9"
17
+ "@nmtjs/client": "0.13.0",
18
+ "@nmtjs/common": "0.13.0",
19
+ "@nmtjs/protocol": "0.13.0"
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
23
  "LICENSE.md",
24
24
  "README.md"
25
25
  ],
26
- "version": "0.12.9",
26
+ "version": "0.13.0",
27
27
  "scripts": {
28
28
  "build": "tsc",
29
29
  "type-check": "tsc --noEmit"