podasync-ws-only 2.9.0-snapshot.1 → 2.9.0-snapshot.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podasync-ws-only",
3
- "version": "2.9.0-snapshot.1",
3
+ "version": "2.9.0-snapshot.2",
4
4
  "description": "Fanap's POD Async service (DIRANA) - Websocket only",
5
5
  "main": "./src/network/async.js",
6
6
  "scripts": {
@@ -66,16 +66,16 @@
66
66
  CLOSED: 3 // The connection is closed or couldn't be opened.
67
67
  },
68
68
  logLevel = LogLevel(params.logLevel),
69
- isNode = Utility.isNode(),
69
+ // isNode = Utility.isNode(),
70
70
  isSocketOpen = false,
71
71
  isDeviceRegister = false,
72
72
  isServerRegister = false,
73
73
  socketState = socketStateType.CONNECTING,
74
- asyncState = '',
74
+ // asyncState = '',
75
75
  registerServerTimeoutId,
76
76
  registerDeviceTimeoutId,
77
77
  checkIfSocketHasOpennedTimeoutId,
78
- asyncReadyTimeoutId,
78
+ // asyncReadyTimeoutId,
79
79
  pushSendDataQueue = [],
80
80
  oldPeerId,
81
81
  peerId = params.peerId,
@@ -884,14 +884,32 @@
884
884
  else if(protocol == "webrtc")
885
885
  webRTCClass.close()
886
886
 
887
- socketReconnectRetryInterval = setTimeout(function () {
887
+ let tmpReconnectOnClose = reconnectOnClose;
888
+ reconnectOnClose = false;
889
+ retryStep.set(0);
890
+
891
+ if(protocol === "websocket")
892
+ socket.connect();
893
+ else if(protocol == "webrtc")
894
+ webRTCClass.connect()
895
+
896
+ setTimeout(function () {
888
897
  // retryStep = 4;
889
- retryStep.set(4);
890
- if(protocol === "websocket")
891
- socket.close();
892
- else if(protocol == "webrtc")
893
- webRTCClass.close()
894
- }, 2000);
898
+ retryStep.set(0);
899
+ reconnectOnClose = tmpReconnectOnClose;
900
+
901
+ if(socketState != socketStateType.OPEN){
902
+ if(protocol === "websocket")
903
+ socket.connect();
904
+ else if(protocol == "webrtc")
905
+ webRTCClass.connect()
906
+ }
907
+
908
+ // if(protocol === "websocket")
909
+ // socket.connect();
910
+ // else if(protocol == "webrtc")
911
+ // webRTCClass.connect()
912
+ }, 4000);
895
913
  };
896
914
 
897
915
  this.generateUUID = Utility.generateUUID;