@webex/calling 3.12.0-mobius-socket.12 → 3.12.0-mobius-socket.14

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 (42) hide show
  1. package/dist/CallingClient/CallingClient.js +22 -30
  2. package/dist/CallingClient/CallingClient.js.map +1 -1
  3. package/dist/CallingClient/calling/call.test.js +1 -1
  4. package/dist/CallingClient/calling/call.test.js.map +1 -1
  5. package/dist/CallingClient/constants.js +15 -3
  6. package/dist/CallingClient/constants.js.map +1 -1
  7. package/dist/CallingClient/registration/register.js +143 -87
  8. package/dist/CallingClient/registration/register.js.map +1 -1
  9. package/dist/CallingClient/registration/register.test.js +1 -1
  10. package/dist/CallingClient/registration/register.test.js.map +1 -1
  11. package/dist/CallingClient/utils/mobiusSocketMapper.js +32 -20
  12. package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -1
  13. package/dist/CallingClient/utils/request.js +46 -5
  14. package/dist/CallingClient/utils/request.js.map +1 -1
  15. package/dist/CallingClient/utils/wsFeatureFlag.js +9 -1
  16. package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -1
  17. package/dist/Metrics/index.js +60 -0
  18. package/dist/Metrics/index.js.map +1 -1
  19. package/dist/Metrics/types.js +11 -1
  20. package/dist/Metrics/types.js.map +1 -1
  21. package/dist/module/CallingClient/CallingClient.js +15 -19
  22. package/dist/module/CallingClient/constants.js +12 -0
  23. package/dist/module/CallingClient/registration/register.js +77 -36
  24. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +11 -0
  25. package/dist/module/CallingClient/utils/request.js +39 -1
  26. package/dist/module/CallingClient/utils/wsFeatureFlag.js +9 -2
  27. package/dist/module/Metrics/index.js +46 -0
  28. package/dist/module/Metrics/types.js +10 -0
  29. package/dist/types/CallingClient/CallingClient.d.ts +0 -1
  30. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  31. package/dist/types/CallingClient/constants.d.ts +12 -0
  32. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  33. package/dist/types/CallingClient/registration/register.d.ts +1 -0
  34. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  35. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -1
  36. package/dist/types/CallingClient/utils/request.d.ts +1 -0
  37. package/dist/types/CallingClient/utils/request.d.ts.map +1 -1
  38. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -1
  39. package/dist/types/Metrics/index.d.ts.map +1 -1
  40. package/dist/types/Metrics/types.d.ts +11 -1
  41. package/dist/types/Metrics/types.d.ts.map +1 -1
  42. package/package.json +1 -1
@@ -100,6 +100,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
100
100
  });
101
101
  }
102
102
  return (0, _createClass2.default)(Registration, [{
103
+ key: "getServerType",
104
+ value: function getServerType(url) {
105
+ var _this$backupMobiusUri;
106
+ return this.primaryMobiusUris.includes(url) && 'PRIMARY' || ((_this$backupMobiusUri = this.backupMobiusUris) === null || _this$backupMobiusUri === void 0 ? void 0 : _this$backupMobiusUri.includes(url)) && 'BACKUP' || 'UNKNOWN';
107
+ }
108
+ }, {
103
109
  key: "getFailoverCacheKey",
104
110
  value: function getFailoverCacheKey() {
105
111
  return "".concat(_constants2.FAILOVER_CACHE_PREFIX, ".").concat(this.userId || 'unknown');
@@ -317,10 +323,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
317
323
  value: (function () {
318
324
  var _restorePreviousRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(caller) {
319
325
  var _this = this;
320
- var abort;
326
+ var loggerContext, abort;
321
327
  return _regenerator.default.wrap(function (_context5) {
322
328
  while (1) switch (_context5.prev = _context5.next) {
323
329
  case 0:
330
+ loggerContext = {
331
+ file: _constants2.REGISTRATION_FILE,
332
+ method: _constants2.METHODS.RESTORE_PREVIOUS_REGISTRATION
333
+ };
334
+ _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " - caller: ").concat(caller, ", activeMobiusUrl: ").concat(this.activeMobiusUrl), loggerContext);
324
335
  abort = false;
325
336
  if (!this.apiRequest.isSocketEnabled()) {
326
337
  _context5.next = 1;
@@ -383,8 +394,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
383
394
  return this.restartRegistration(caller);
384
395
  case 6:
385
396
  this.retryAfter = undefined;
397
+ _Logger.default.log("restorePreviousRegistration completed via 429 retry-after path - caller: ".concat(caller), loggerContext);
386
398
  return _context5.abrupt("return", true);
387
399
  case 7:
400
+ _Logger.default.log("restorePreviousRegistration completed - caller: ".concat(caller, ", deviceRegistered: ").concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
388
401
  return _context5.abrupt("return", abort);
389
402
  case 8:
390
403
  case "end":
@@ -405,12 +418,17 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
405
418
  key: "handle404KeepaliveFailure",
406
419
  value: (function () {
407
420
  var _handle404KeepaliveFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(caller) {
408
- var abort;
421
+ var loggerContext, abort;
409
422
  return _regenerator.default.wrap(function (_context6) {
410
423
  while (1) switch (_context6.prev = _context6.next) {
411
424
  case 0:
425
+ loggerContext = {
426
+ file: _constants2.REGISTRATION_FILE,
427
+ method: _constants2.METHODS.HANDLE_404_KEEPALIVE_FAILURE
428
+ };
429
+ _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " - caller: ").concat(caller), loggerContext);
412
430
  if (!(caller === _constants2.KEEPALIVE_UTIL)) {
413
- _context6.next = 2;
431
+ _context6.next = 4;
414
432
  break;
415
433
  }
416
434
  _context6.next = 1;
@@ -418,12 +436,18 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
418
436
  case 1:
419
437
  abort = _context6.sent;
420
438
  if (!(!abort && !this.isDeviceRegistered())) {
421
- _context6.next = 2;
439
+ _context6.next = 3;
422
440
  break;
423
441
  }
442
+ _Logger.default.warn('Keepalive 404 recovery: re-registration did not complete, starting failover timer', loggerContext);
424
443
  _context6.next = 2;
425
444
  return this.startFailoverTimer();
426
445
  case 2:
446
+ _context6.next = 4;
447
+ break;
448
+ case 3:
449
+ _Logger.default.log("Keepalive 404 recovery handled - deviceRegistered: ".concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
450
+ case 4:
427
451
  case "end":
428
452
  return _context6.stop();
429
453
  }
@@ -616,15 +640,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
616
640
  }, _callee0);
617
641
  })), interval * _constants2.SEC_TO_MSEC_MFACTOR);
618
642
  _Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
619
- _context11.next = 6;
643
+ _context11.next = 7;
620
644
  break;
621
645
  case 1:
622
646
  if (!this.backupMobiusUris.length) {
623
- _context11.next = 4;
647
+ _context11.next = 5;
624
648
  break;
625
649
  }
626
650
  if (!this.apiRequest.isSocketEnabled()) {
627
- _context11.next = 2;
651
+ _context11.next = 3;
628
652
  break;
629
653
  }
630
654
  _Logger.default.info('Disconnecting from primary Mobius socket for failover to backup servers', loggerContext);
@@ -634,6 +658,8 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
634
658
  reason: 'done (permanent)'
635
659
  });
636
660
  case 2:
661
+ _Logger.default.log('Mobius socket disconnect complete prior to backup failover', loggerContext);
662
+ case 3:
637
663
  this.saveFailoverState({
638
664
  attempt: attempt,
639
665
  timeElapsed: timeElapsed,
@@ -642,9 +668,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
642
668
  });
643
669
  _Logger.default.info('Failing over to backup servers.', loggerContext);
644
670
  this.failoverImmediately = false;
645
- _context11.next = 3;
671
+ _context11.next = 4;
646
672
  return this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, this.backupMobiusUris);
647
- case 3:
673
+ case 4:
648
674
  abort = _context11.sent;
649
675
  if (!abort && !this.isDeviceRegistered()) {
650
676
  interval = this.getRegRetryInterval();
@@ -688,16 +714,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
688
714
  })), interval * _constants2.SEC_TO_MSEC_MFACTOR);
689
715
  _Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
690
716
  }
691
- _context11.next = 6;
717
+ _context11.next = 7;
692
718
  break;
693
- case 4:
694
- _context11.next = 5;
695
- return (0, _common.uploadLogs)();
696
719
  case 5:
720
+ _context11.next = 6;
721
+ return (0, _common.uploadLogs)();
722
+ case 6:
697
723
  (0, _common.emitFinalFailure)(function (clientError) {
698
724
  _this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
699
725
  }, loggerContext, interval < 0 ? 'Timer threshold exceeded during failover' : undefined);
700
- case 6:
726
+ case 7:
701
727
  case "end":
702
728
  return _context11.stop();
703
729
  }
@@ -851,13 +877,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
851
877
  }, {
852
878
  key: "initiateFailback",
853
879
  value: function initiateFailback() {
880
+ var loggerContext = {
881
+ file: _constants2.REGISTRATION_FILE,
882
+ method: _constants2.METHODS.INITIATE_FAILBACK
883
+ };
854
884
  if (this.isFailbackRequired()) {
855
885
  if (!this.failbackTimer) {
856
886
  this.failback429RetryAttempts = 0;
857
887
  var intervalInMinutes = this.getFailbackInterval();
888
+ _Logger.default.info("Scheduling failback to primary - intervalMinutes: ".concat(intervalInMinutes), loggerContext);
858
889
  this.startFailbackTimer(intervalInMinutes * _constants2.MINUTES_TO_SEC_MFACTOR);
890
+ } else {
891
+ _Logger.default.info('Failback timer already scheduled, skipping', loggerContext);
859
892
  }
860
893
  } else {
894
+ _Logger.default.info('Failback not required, clearing any pending failback timer', loggerContext);
861
895
  this.failback429RetryAttempts = 0;
862
896
  this.clearFailbackTimer();
863
897
  }
@@ -897,9 +931,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
897
931
  value: (function () {
898
932
  var _executeFailback = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
899
933
  var _this5 = this;
934
+ var loggerContext;
900
935
  return _regenerator.default.wrap(function (_context16) {
901
936
  while (1) switch (_context16.prev = _context16.next) {
902
937
  case 0:
938
+ loggerContext = {
939
+ file: _constants2.REGISTRATION_FILE,
940
+ method: _constants2.METHODS.EXECUTE_FAILBACK
941
+ };
942
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
903
943
  _context16.next = 1;
904
944
  return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
905
945
  var primaryServerStatus, abort, abortNew;
@@ -907,7 +947,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
907
947
  while (1) switch (_context15.prev = _context15.next) {
908
948
  case 0:
909
949
  if (!_this5.isFailbackRequired()) {
910
- _context15.next = 12;
950
+ _context15.next = 13;
911
951
  break;
912
952
  }
913
953
  _context15.next = 1;
@@ -915,70 +955,67 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
915
955
  case 1:
916
956
  primaryServerStatus = _context15.sent;
917
957
  if (!((0, _keys.default)(_this5.callManager.getActiveCalls()).length === 0 && primaryServerStatus)) {
918
- _context15.next = 11;
958
+ _context15.next = 12;
919
959
  break;
920
960
  }
921
- _Logger.default.info("Attempting failback to primary.", {
922
- file: _constants2.REGISTRATION_FILE,
923
- method: _this5.executeFailback.name
924
- });
961
+ _Logger.default.info("Attempting failback to primary.", loggerContext);
925
962
  _context15.next = 2;
926
963
  return _this5.deregister();
927
964
  case 2:
928
965
  if (!_this5.apiRequest.isSocketEnabled()) {
929
- _context15.next = 3;
966
+ _context15.next = 4;
930
967
  break;
931
968
  }
969
+ _Logger.default.info('Disconnecting from backup Mobius socket for failback to primary', loggerContext);
932
970
  _context15.next = 3;
933
971
  return _this5.apiRequest.disconnectFromMobiusSocket({
934
972
  code: 3050,
935
973
  reason: 'done (permanent)'
936
974
  });
937
975
  case 3:
938
- _context15.next = 4;
939
- return _this5.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
976
+ _Logger.default.log('Mobius socket disconnect complete prior to primary failback', loggerContext);
940
977
  case 4:
978
+ _context15.next = 5;
979
+ return _this5.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
980
+ case 5:
941
981
  abort = _context15.sent;
942
982
  if (!(_this5.scheduled429Retry || abort || _this5.isDeviceRegistered())) {
943
- _context15.next = 5;
983
+ _context15.next = 6;
944
984
  break;
945
985
  }
946
986
  return _context15.abrupt("return");
947
- case 5:
948
- _context15.next = 6;
949
- return _this5.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
950
987
  case 6:
988
+ _context15.next = 7;
989
+ return _this5.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
990
+ case 7:
951
991
  abortNew = _context15.sent;
952
992
  if (!abortNew) {
953
- _context15.next = 7;
993
+ _context15.next = 8;
954
994
  break;
955
995
  }
956
996
  _this5.clearFailbackTimer();
957
997
  return _context15.abrupt("return");
958
- case 7:
998
+ case 8:
959
999
  if (_this5.isDeviceRegistered()) {
960
- _context15.next = 9;
1000
+ _context15.next = 10;
961
1001
  break;
962
1002
  }
963
- _context15.next = 8;
964
- return _this5.restartRegistration(_this5.executeFailback.name);
965
- case 8:
966
- _context15.next = 10;
967
- break;
1003
+ _context15.next = 9;
1004
+ return _this5.restartRegistration(loggerContext.method);
968
1005
  case 9:
1006
+ _context15.next = 11;
1007
+ break;
1008
+ case 10:
969
1009
  _this5.failbackTimer = undefined;
970
1010
  _this5.initiateFailback();
971
- case 10:
972
- _context15.next = 12;
973
- break;
974
1011
  case 11:
975
- _Logger.default.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', {
976
- file: _constants2.REGISTRATION_FILE,
977
- method: _this5.executeFailback.name
978
- });
1012
+ _context15.next = 13;
1013
+ break;
1014
+ case 12:
1015
+ _Logger.default.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', loggerContext);
979
1016
  _this5.failbackTimer = undefined;
980
1017
  _this5.initiateFailback();
981
- case 12:
1018
+ case 13:
982
1019
  case "end":
983
1020
  return _context15.stop();
984
1021
  }
@@ -1052,10 +1089,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1052
1089
  key: "restartRegistration",
1053
1090
  value: (function () {
1054
1091
  var _restartRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(caller) {
1055
- var abort;
1092
+ var loggerContext, abort;
1056
1093
  return _regenerator.default.wrap(function (_context17) {
1057
1094
  while (1) switch (_context17.prev = _context17.next) {
1058
1095
  case 0:
1096
+ loggerContext = {
1097
+ file: _constants2.REGISTRATION_FILE,
1098
+ method: _constants2.METHODS.RESTART_REGISTRATION
1099
+ };
1100
+ _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " - caller: ").concat(caller), loggerContext);
1101
+
1059
1102
  /*
1060
1103
  * Cancel any failback timer running
1061
1104
  * and start fresh registration attempt with retry as true.
@@ -1073,6 +1116,8 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1073
1116
  _context17.next = 2;
1074
1117
  return this.startFailoverTimer();
1075
1118
  case 2:
1119
+ _Logger.default.log("restartRegistration completed - caller: ".concat(caller, ", deviceRegistered: ").concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
1120
+ case 3:
1076
1121
  case "end":
1077
1122
  return _context17.stop();
1078
1123
  }
@@ -1229,10 +1274,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1229
1274
  key: "triggerRegistration",
1230
1275
  value: (function () {
1231
1276
  var _triggerRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1232
- var abort;
1277
+ var loggerContext, abort;
1233
1278
  return _regenerator.default.wrap(function (_context21) {
1234
1279
  while (1) switch (_context21.prev = _context21.next) {
1235
1280
  case 0:
1281
+ loggerContext = {
1282
+ file: _constants2.REGISTRATION_FILE,
1283
+ method: _constants2.METHODS.TRIGGER_REGISTRATION
1284
+ };
1285
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
1236
1286
  _context21.next = 1;
1237
1287
  return this.resumeFailover();
1238
1288
  case 1:
@@ -1240,10 +1290,11 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1240
1290
  _context21.next = 2;
1241
1291
  break;
1242
1292
  }
1293
+ _Logger.default.info('Registration trigger handled by resumeFailover path', loggerContext);
1243
1294
  return _context21.abrupt("return");
1244
1295
  case 2:
1245
1296
  if (!(this.primaryMobiusUris.length > 0)) {
1246
- _context21.next = 4;
1297
+ _context21.next = 5;
1247
1298
  break;
1248
1299
  }
1249
1300
  _context21.next = 3;
@@ -1257,6 +1308,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1257
1308
  _context21.next = 4;
1258
1309
  return this.startFailoverTimer();
1259
1310
  case 4:
1311
+ _Logger.default.log("triggerRegistration completed - deviceRegistered: ".concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
1312
+ _context21.next = 6;
1313
+ break;
1314
+ case 5:
1315
+ _Logger.default.warn('triggerRegistration skipped: no primary Mobius URIs available', loggerContext);
1316
+ case 6:
1260
1317
  case "end":
1261
1318
  return _context21.stop();
1262
1319
  }
@@ -1282,6 +1339,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1282
1339
  var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22(caller) {
1283
1340
  var _this8 = this;
1284
1341
  var servers,
1342
+ loggerContext,
1285
1343
  abort,
1286
1344
  connectedWebSocketUrl,
1287
1345
  _iterator2,
@@ -1294,6 +1352,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1294
1352
  while (1) switch (_context23.prev = _context23.next) {
1295
1353
  case 0:
1296
1354
  servers = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : this.primaryMobiusUris;
1355
+ loggerContext = {
1356
+ file: _constants2.REGISTRATION_FILE,
1357
+ method: _constants2.REGISTER_UTIL
1358
+ };
1297
1359
  abort = false;
1298
1360
  this.retryAfter = undefined;
1299
1361
  if (!this.failoverImmediately) {
@@ -1306,40 +1368,37 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1306
1368
  _context23.next = 2;
1307
1369
  break;
1308
1370
  }
1309
- _Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
1310
- file: _constants2.REGISTRATION_FILE,
1311
- method: _constants2.REGISTER_UTIL
1312
- });
1371
+ _Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), loggerContext);
1313
1372
  return _context23.abrupt("return", abort);
1314
1373
  case 2:
1315
1374
  _iterator2 = _createForOfIteratorHelper(servers);
1316
1375
  _context23.prev = 3;
1317
1376
  _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
1318
- var _this8$backupMobiusUr;
1319
1377
  var url, serverType, _this8$deviceInfo$dev, _resp$headers, _resp$headers$trackin, _resp$headers2, _this8$deviceInfo$dev2, wssNormalizedUrl, resp, body, _yield$handleRegistra, finalError, shouldDisconnect, _t5;
1320
1378
  return _regenerator.default.wrap(function (_context22) {
1321
1379
  while (1) switch (_context22.prev = _context22.next) {
1322
1380
  case 0:
1323
1381
  url = _step2.value;
1324
- serverType = _this8.primaryMobiusUris.includes(url) && 'PRIMARY' || ((_this8$backupMobiusUr = _this8.backupMobiusUris) === null || _this8$backupMobiusUr === void 0 ? void 0 : _this8$backupMobiusUr.includes(url)) && 'BACKUP' || 'UNKNOWN';
1382
+ serverType = _this8.getServerType(url);
1325
1383
  _context22.prev = 1;
1326
1384
  abort = false;
1327
1385
  _this8.registrationStatus = _types2.RegistrationStatus.INACTIVE;
1328
1386
  _this8.lineEmitter(_types3.LINE_EVENTS.CONNECTING);
1329
- _Logger.default.info("[".concat(caller, "] : Mobius url to contact: ").concat(url), {
1330
- file: _constants2.REGISTRATION_FILE,
1331
- method: _constants2.REGISTER_UTIL
1332
- });
1387
+ _Logger.default.info("[".concat(caller, "] : Mobius url to contact: ").concat(url), loggerContext);
1333
1388
  if (!_this8.apiRequest.isSocketEnabled()) {
1334
1389
  _context22.next = 3;
1335
1390
  break;
1336
1391
  }
1337
- wssNormalizedUrl = url.endsWith('/') ? url.slice(0, -1) : url; // eslint-disable-next-line no-await-in-loop
1392
+ wssNormalizedUrl = url.endsWith('/') ? url.slice(0, -1) : url;
1393
+ _Logger.default.info("[".concat(caller, "] : Connecting to Mobius WebSocket - serverType: ").concat(serverType, ", wssUrl: ").concat(wssNormalizedUrl), loggerContext);
1394
+
1395
+ // eslint-disable-next-line no-await-in-loop
1338
1396
  _context22.next = 2;
1339
1397
  return _this8.apiRequest.connectToMobiusSocket(wssNormalizedUrl);
1340
1398
  case 2:
1341
1399
  connectedWebSocketUrl = _context22.sent;
1342
1400
  connectedWebSocketUrl = connectedWebSocketUrl ? "".concat(connectedWebSocketUrl, "/") : undefined;
1401
+ _Logger.default.log("[".concat(caller, "] : Mobius WebSocket connected - serverType: ").concat(serverType, ", connectedWebSocketUrl: ").concat(connectedWebSocketUrl), loggerContext);
1343
1402
  case 3:
1344
1403
  _context22.next = 4;
1345
1404
  return _this8.postRegistration(url);
@@ -1350,10 +1409,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1350
1409
  _this8.registrationStatus = _types2.RegistrationStatus.ACTIVE;
1351
1410
  _this8.setActiveMobiusUrl(connectedWebSocketUrl || url);
1352
1411
  _this8.lineEmitter(_types3.LINE_EVENTS.REGISTERED, resp.body);
1353
- _Logger.default.log("Registration successful for deviceId: ".concat((_this8$deviceInfo$dev = _this8.deviceInfo.device) === null || _this8$deviceInfo$dev === void 0 ? void 0 : _this8$deviceInfo$dev.deviceId, " userId: ").concat(_this8.userId, " responseTrackingId: ").concat((_resp$headers = resp.headers) === null || _resp$headers === void 0 ? void 0 : _resp$headers.trackingid), {
1354
- file: _constants2.REGISTRATION_FILE,
1355
- method: _constants2.METHODS.REGISTER
1356
- });
1412
+ _Logger.default.log("Registration successful for deviceId: ".concat((_this8$deviceInfo$dev = _this8.deviceInfo.device) === null || _this8$deviceInfo$dev === void 0 ? void 0 : _this8$deviceInfo$dev.deviceId, " userId: ").concat(_this8.userId, " responseTrackingId: ").concat((_resp$headers = resp.headers) === null || _resp$headers === void 0 ? void 0 : _resp$headers.trackingid), loggerContext);
1357
1413
  _this8.setIntervalValues(_this8.deviceInfo);
1358
1414
  _this8.metricManager.setDeviceInfo(_this8.deviceInfo);
1359
1415
  _this8.metricManager.submitRegistrationMetric(_types.METRIC_EVENT.REGISTRATION, _types.REG_ACTION.REGISTER, _types.METRIC_TYPE.BEHAVIORAL, caller, serverType, (_resp$headers$trackin = (_resp$headers2 = resp.headers) === null || _resp$headers2 === void 0 ? void 0 : _resp$headers2.trackingid) !== null && _resp$headers$trackin !== void 0 ? _resp$headers$trackin : '', undefined, undefined);
@@ -1388,17 +1444,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1388
1444
  _context22.next = 7;
1389
1445
  break;
1390
1446
  }
1391
- _Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(_this8.activeMobiusUrl), {
1392
- file: _constants2.REGISTRATION_FILE,
1393
- method: _this8.attemptRegistrationWithServers.name
1394
- });
1447
+ _Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(_this8.activeMobiusUrl), loggerContext);
1395
1448
  return _context22.abrupt("return", 0);
1396
1449
  case 7:
1397
1450
  if (!(shouldDisconnect && _this8.apiRequest.isSocketEnabled())) {
1398
- _context22.next = 8;
1451
+ _context22.next = 9;
1399
1452
  break;
1400
1453
  }
1401
1454
  connectedWebSocketUrl = undefined;
1455
+ _Logger.default.info("[".concat(caller, "] : Tearing down Mobius WebSocket after registration error - serverType: ").concat(serverType), loggerContext);
1456
+
1402
1457
  // eslint-disable-next-line no-await-in-loop
1403
1458
  _context22.next = 8;
1404
1459
  return _this8.apiRequest.disconnectFromMobiusSocket({
@@ -1406,17 +1461,19 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1406
1461
  reason: 'done (permanent)'
1407
1462
  });
1408
1463
  case 8:
1464
+ _Logger.default.log("[".concat(caller, "] : Mobius WebSocket disconnect complete after registration error - serverType: ").concat(serverType), loggerContext);
1465
+ case 9:
1409
1466
  if (!abort) {
1410
- _context22.next = 10;
1467
+ _context22.next = 11;
1411
1468
  break;
1412
1469
  }
1413
1470
  _this8.setStatus(_types2.RegistrationStatus.INACTIVE);
1414
1471
  // eslint-disable-next-line no-await-in-loop
1415
- _context22.next = 9;
1472
+ _context22.next = 10;
1416
1473
  return (0, _common.uploadLogs)();
1417
- case 9:
1418
- return _context22.abrupt("return", 0);
1419
1474
  case 10:
1475
+ return _context22.abrupt("return", 0);
1476
+ case 11:
1420
1477
  case "end":
1421
1478
  return _context22.stop();
1422
1479
  }
@@ -1649,36 +1706,35 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1649
1706
  key: "deregister",
1650
1707
  value: function () {
1651
1708
  var _deregister = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1652
- var _this$deviceInfo$devi2, _this$deviceInfo$devi3, _t8;
1709
+ var loggerContext, _this$deviceInfo$devi2, _this$deviceInfo$devi3, _t8;
1653
1710
  return _regenerator.default.wrap(function (_context27) {
1654
1711
  while (1) switch (_context27.prev = _context27.next) {
1655
1712
  case 0:
1656
- _context27.prev = 0;
1657
- _context27.next = 1;
1658
- return this.deleteRegistration(this.activeMobiusUrl, (_this$deviceInfo$devi2 = this.deviceInfo.device) === null || _this$deviceInfo$devi2 === void 0 ? void 0 : _this$deviceInfo$devi2.deviceId, (_this$deviceInfo$devi3 = this.deviceInfo.device) === null || _this$deviceInfo$devi3 === void 0 ? void 0 : _this$deviceInfo$devi3.clientDeviceUri);
1659
- case 1:
1660
- _Logger.default.log('Registration successfully deregistered', {
1713
+ loggerContext = {
1661
1714
  file: _constants2.REGISTRATION_FILE,
1662
1715
  method: _constants2.METHODS.DEREGISTER
1663
- });
1664
- _context27.next = 3;
1665
- break;
1716
+ };
1717
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
1718
+ _context27.prev = 1;
1719
+ _context27.next = 2;
1720
+ return this.deleteRegistration(this.activeMobiusUrl, (_this$deviceInfo$devi2 = this.deviceInfo.device) === null || _this$deviceInfo$devi2 === void 0 ? void 0 : _this$deviceInfo$devi2.deviceId, (_this$deviceInfo$devi3 = this.deviceInfo.device) === null || _this$deviceInfo$devi3 === void 0 ? void 0 : _this$deviceInfo$devi3.clientDeviceUri);
1666
1721
  case 2:
1667
- _context27.prev = 2;
1668
- _t8 = _context27["catch"](0);
1669
- _Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_t8)), {
1670
- file: _constants2.REGISTRATION_FILE,
1671
- method: _constants2.METHODS.DEREGISTER
1672
- });
1722
+ _Logger.default.log('Registration successfully deregistered', loggerContext);
1723
+ _context27.next = 4;
1724
+ break;
1673
1725
  case 3:
1726
+ _context27.prev = 3;
1727
+ _t8 = _context27["catch"](1);
1728
+ _Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_t8)), loggerContext);
1729
+ case 4:
1674
1730
  this.clearKeepaliveTimer();
1675
1731
  this.setStatus(_types2.RegistrationStatus.INACTIVE);
1676
1732
  this.clearFailoverState();
1677
- case 4:
1733
+ case 5:
1678
1734
  case "end":
1679
1735
  return _context27.stop();
1680
1736
  }
1681
- }, _callee26, this, [[0, 2]]);
1737
+ }, _callee26, this, [[1, 3]]);
1682
1738
  }));
1683
1739
  function deregister() {
1684
1740
  return _deregister.apply(this, arguments);