@resolveio/client-lib-core 1.4.0 → 1.4.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.
@@ -225,7 +225,7 @@ class SocketService {
225
225
  this.pingInterval = null;
226
226
  this.pongTimeout = null;
227
227
  this.pingIntervalTime = 15000; // Time between each ping (e.g., 30 seconds)
228
- this.pongTimeoutTime = 15000; // Time to wait for pong before closing connection (e.g., 10 seconds)
228
+ this.pongTimeoutTime = 12000; // Time to wait for pong before closing connection (e.g., 10 seconds)
229
229
  //Set up the default 'noop' event handlers
230
230
  this.onopen = function (event) { };
231
231
  this.onclose = function (event) { };
@@ -295,7 +295,7 @@ class SocketService {
295
295
  startPinging() {
296
296
  this.pingInterval = setInterval(() => {
297
297
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
298
- this.ws.send(['ping'].toString()); // You can adjust this based on the server's expectations
298
+ this.ws.send(JSON.stringify(['ping'])); // You can adjust this based on the server's expectations
299
299
  this.pongTimeout = setTimeout(() => {
300
300
  this.log(new Date(), 'WS', 'pong not received, closing connection');
301
301
  this.close();
@@ -317,14 +317,11 @@ class SocketService {
317
317
  return true;
318
318
  }
319
319
  else {
320
- this.log(new Date(), 'WS', 'send error', this.ws.readyState);
320
+ this.log(new Date(), 'WS', 'send error', this.readyState);
321
321
  this.reconnect();
322
322
  return false;
323
323
  }
324
324
  }
325
- /**
326
- * Returns boolean, whether websocket was FORCEFULLY closed.
327
- */
328
325
  close() {
329
326
  if (this.ws) {
330
327
  this.log(new Date(), 'WS', 'closing socket');
@@ -1234,7 +1231,7 @@ class SocketManagerService {
1234
1231
  if (!this._runningQueue) {
1235
1232
  if (this._sendQueue.length) {
1236
1233
  this._runningQueue = true;
1237
- if (this._socket && this._socket.ws && this.socketStatus === WebSocket.OPEN) {
1234
+ if (this._socket && this._socket.ws) {
1238
1235
  let nextSendItem = this._sendQueue[this._sendQueue.length - 1];
1239
1236
  let sendStatus = this._socket.send(...nextSendItem);
1240
1237
  if (sendStatus) {
@@ -1338,14 +1335,7 @@ class SocketManagerService {
1338
1335
  }
1339
1336
  send(...data) {
1340
1337
  if (data[3] === 'subscription') {
1341
- if (this.socketStatus === WebSocket.OPEN) {
1342
- this._socket.send(...data);
1343
- }
1344
- else {
1345
- if (!this._sendQueue.filter(a => JSON.stringify(a) === JSON.stringify(data)).length) {
1346
- this._sendQueue.splice(0, 0, data);
1347
- }
1348
- }
1338
+ this._socket.send(...data);
1349
1339
  }
1350
1340
  else if (data[3] === 'method') {
1351
1341
  if (this.socketStatus === WebSocket.OPEN) {
@@ -1430,9 +1420,7 @@ class SocketManagerService {
1430
1420
  }
1431
1421
  }
1432
1422
  else if (data[3] === 'offline') {
1433
- if (this.socketStatus === WebSocket.OPEN) {
1434
- this._socket.send(...data);
1435
- }
1423
+ this._socket.send(...data);
1436
1424
  }
1437
1425
  }
1438
1426
  getStatus() {