core-3nweb-client-lib 0.42.6 → 0.42.7

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.
@@ -9,6 +9,7 @@ export interface WSException extends web3n.RuntimeException {
9
9
  }
10
10
  export declare function makeWSException(params: Partial<WSException>, flags?: Partial<WSException>): WSException;
11
11
  export interface ConnectionStatus {
12
+ url: string;
12
13
  /**
13
14
  * ping number is a number of millisecond between previous and current data receiving from server.
14
15
  */
@@ -36,7 +36,7 @@ const MAX_TXT_BUFFER = 64 * 1024;
36
36
  */
37
37
  function makeJsonCommPoint(ws) {
38
38
  const observers = new generic_ipc_1.MultiObserverWrap();
39
- const { heartbeat, healthyBeat, otherBeat } = makeHeartbeat();
39
+ const { heartbeat, healthyBeat, otherBeat } = makeHeartbeat(ws.url);
40
40
  ws.on('message', data => {
41
41
  if (typeof data !== 'string') {
42
42
  return;
@@ -59,7 +59,7 @@ function makeJsonCommPoint(ws) {
59
59
  });
60
60
  ws.on('close', (code, reason) => {
61
61
  if (code === 1000) {
62
- otherBeat(undefined, true);
62
+ otherBeat({ socketClosed: true }, true);
63
63
  observers.complete();
64
64
  }
65
65
  else {
@@ -91,24 +91,23 @@ function makeJsonCommPoint(ws) {
91
91
  };
92
92
  return { comm, heartbeat };
93
93
  }
94
- function makeHeartbeat() {
94
+ function makeHeartbeat(url) {
95
95
  const status = new rxjs_1.Subject();
96
96
  let lastInfo = Date.now();
97
97
  function healthyBeat() {
98
98
  const now = Date.now();
99
99
  status.next({
100
+ url,
100
101
  ping: now - lastInfo
101
102
  });
102
103
  lastInfo = now;
103
104
  }
104
- function otherBeat(beat, end = false) {
105
- if (beat) {
106
- status.next(beat);
107
- }
105
+ function otherBeat(params, end = false) {
106
+ status.next({
107
+ url,
108
+ ...params
109
+ });
108
110
  if (end) {
109
- status.next({
110
- socketClosed: true
111
- });
112
111
  status.complete();
113
112
  }
114
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.42.6",
3
+ "version": "0.42.7",
4
4
  "description": "3NWeb client core library, embeddable into different environments",
5
5
  "main": "build/lib-index.js",
6
6
  "types": "build/lib-index.d.ts",