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

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 (31) hide show
  1. package/dist/CallingClient/CallingClient.js +21 -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 +136 -85
  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 +32 -3
  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/module/CallingClient/CallingClient.js +13 -18
  18. package/dist/module/CallingClient/constants.js +12 -0
  19. package/dist/module/CallingClient/registration/register.js +71 -33
  20. package/dist/module/CallingClient/utils/mobiusSocketMapper.js +11 -0
  21. package/dist/module/CallingClient/utils/request.js +29 -1
  22. package/dist/module/CallingClient/utils/wsFeatureFlag.js +9 -2
  23. package/dist/types/CallingClient/CallingClient.d.ts +0 -1
  24. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  25. package/dist/types/CallingClient/constants.d.ts +12 -0
  26. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  27. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  28. package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -1
  29. package/dist/types/CallingClient/utils/request.d.ts.map +1 -1
  30. package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -1
  31. package/package.json +1 -1
@@ -317,10 +317,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
317
317
  value: (function () {
318
318
  var _restorePreviousRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(caller) {
319
319
  var _this = this;
320
- var abort;
320
+ var loggerContext, abort;
321
321
  return _regenerator.default.wrap(function (_context5) {
322
322
  while (1) switch (_context5.prev = _context5.next) {
323
323
  case 0:
324
+ loggerContext = {
325
+ file: _constants2.REGISTRATION_FILE,
326
+ method: _constants2.METHODS.RESTORE_PREVIOUS_REGISTRATION
327
+ };
328
+ _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " - caller: ").concat(caller, ", activeMobiusUrl: ").concat(this.activeMobiusUrl), loggerContext);
324
329
  abort = false;
325
330
  if (!this.apiRequest.isSocketEnabled()) {
326
331
  _context5.next = 1;
@@ -383,8 +388,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
383
388
  return this.restartRegistration(caller);
384
389
  case 6:
385
390
  this.retryAfter = undefined;
391
+ _Logger.default.log("restorePreviousRegistration completed via 429 retry-after path - caller: ".concat(caller), loggerContext);
386
392
  return _context5.abrupt("return", true);
387
393
  case 7:
394
+ _Logger.default.log("restorePreviousRegistration completed - caller: ".concat(caller, ", deviceRegistered: ").concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
388
395
  return _context5.abrupt("return", abort);
389
396
  case 8:
390
397
  case "end":
@@ -405,12 +412,17 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
405
412
  key: "handle404KeepaliveFailure",
406
413
  value: (function () {
407
414
  var _handle404KeepaliveFailure = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6(caller) {
408
- var abort;
415
+ var loggerContext, abort;
409
416
  return _regenerator.default.wrap(function (_context6) {
410
417
  while (1) switch (_context6.prev = _context6.next) {
411
418
  case 0:
419
+ loggerContext = {
420
+ file: _constants2.REGISTRATION_FILE,
421
+ method: _constants2.METHODS.HANDLE_404_KEEPALIVE_FAILURE
422
+ };
423
+ _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " - caller: ").concat(caller), loggerContext);
412
424
  if (!(caller === _constants2.KEEPALIVE_UTIL)) {
413
- _context6.next = 2;
425
+ _context6.next = 4;
414
426
  break;
415
427
  }
416
428
  _context6.next = 1;
@@ -418,12 +430,18 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
418
430
  case 1:
419
431
  abort = _context6.sent;
420
432
  if (!(!abort && !this.isDeviceRegistered())) {
421
- _context6.next = 2;
433
+ _context6.next = 3;
422
434
  break;
423
435
  }
436
+ _Logger.default.warn('Keepalive 404 recovery: re-registration did not complete, starting failover timer', loggerContext);
424
437
  _context6.next = 2;
425
438
  return this.startFailoverTimer();
426
439
  case 2:
440
+ _context6.next = 4;
441
+ break;
442
+ case 3:
443
+ _Logger.default.log("Keepalive 404 recovery handled - deviceRegistered: ".concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
444
+ case 4:
427
445
  case "end":
428
446
  return _context6.stop();
429
447
  }
@@ -616,15 +634,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
616
634
  }, _callee0);
617
635
  })), interval * _constants2.SEC_TO_MSEC_MFACTOR);
618
636
  _Logger.default.log("Scheduled retry with primary in ".concat(interval, " seconds, number of attempts : ").concat(attempt), loggerContext);
619
- _context11.next = 6;
637
+ _context11.next = 7;
620
638
  break;
621
639
  case 1:
622
640
  if (!this.backupMobiusUris.length) {
623
- _context11.next = 4;
641
+ _context11.next = 5;
624
642
  break;
625
643
  }
626
644
  if (!this.apiRequest.isSocketEnabled()) {
627
- _context11.next = 2;
645
+ _context11.next = 3;
628
646
  break;
629
647
  }
630
648
  _Logger.default.info('Disconnecting from primary Mobius socket for failover to backup servers', loggerContext);
@@ -634,6 +652,8 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
634
652
  reason: 'done (permanent)'
635
653
  });
636
654
  case 2:
655
+ _Logger.default.log('Mobius socket disconnect complete prior to backup failover', loggerContext);
656
+ case 3:
637
657
  this.saveFailoverState({
638
658
  attempt: attempt,
639
659
  timeElapsed: timeElapsed,
@@ -642,9 +662,9 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
642
662
  });
643
663
  _Logger.default.info('Failing over to backup servers.', loggerContext);
644
664
  this.failoverImmediately = false;
645
- _context11.next = 3;
665
+ _context11.next = 4;
646
666
  return this.attemptRegistrationWithServers(_constants2.FAILOVER_UTIL, this.backupMobiusUris);
647
- case 3:
667
+ case 4:
648
668
  abort = _context11.sent;
649
669
  if (!abort && !this.isDeviceRegistered()) {
650
670
  interval = this.getRegRetryInterval();
@@ -688,16 +708,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
688
708
  })), interval * _constants2.SEC_TO_MSEC_MFACTOR);
689
709
  _Logger.default.log("Scheduled retry with backup servers in ".concat(interval, " seconds."), loggerContext);
690
710
  }
691
- _context11.next = 6;
711
+ _context11.next = 7;
692
712
  break;
693
- case 4:
694
- _context11.next = 5;
695
- return (0, _common.uploadLogs)();
696
713
  case 5:
714
+ _context11.next = 6;
715
+ return (0, _common.uploadLogs)();
716
+ case 6:
697
717
  (0, _common.emitFinalFailure)(function (clientError) {
698
718
  _this3.lineEmitter(_types3.LINE_EVENTS.ERROR, undefined, clientError);
699
719
  }, loggerContext, interval < 0 ? 'Timer threshold exceeded during failover' : undefined);
700
- case 6:
720
+ case 7:
701
721
  case "end":
702
722
  return _context11.stop();
703
723
  }
@@ -851,13 +871,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
851
871
  }, {
852
872
  key: "initiateFailback",
853
873
  value: function initiateFailback() {
874
+ var loggerContext = {
875
+ file: _constants2.REGISTRATION_FILE,
876
+ method: _constants2.METHODS.INITIATE_FAILBACK
877
+ };
854
878
  if (this.isFailbackRequired()) {
855
879
  if (!this.failbackTimer) {
856
880
  this.failback429RetryAttempts = 0;
857
881
  var intervalInMinutes = this.getFailbackInterval();
882
+ _Logger.default.info("Scheduling failback to primary - intervalMinutes: ".concat(intervalInMinutes), loggerContext);
858
883
  this.startFailbackTimer(intervalInMinutes * _constants2.MINUTES_TO_SEC_MFACTOR);
884
+ } else {
885
+ _Logger.default.info('Failback timer already scheduled, skipping', loggerContext);
859
886
  }
860
887
  } else {
888
+ _Logger.default.info('Failback not required, clearing any pending failback timer', loggerContext);
861
889
  this.failback429RetryAttempts = 0;
862
890
  this.clearFailbackTimer();
863
891
  }
@@ -897,9 +925,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
897
925
  value: (function () {
898
926
  var _executeFailback = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16() {
899
927
  var _this5 = this;
928
+ var loggerContext;
900
929
  return _regenerator.default.wrap(function (_context16) {
901
930
  while (1) switch (_context16.prev = _context16.next) {
902
931
  case 0:
932
+ loggerContext = {
933
+ file: _constants2.REGISTRATION_FILE,
934
+ method: _constants2.METHODS.EXECUTE_FAILBACK
935
+ };
936
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
903
937
  _context16.next = 1;
904
938
  return this.mutex.runExclusive(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
905
939
  var primaryServerStatus, abort, abortNew;
@@ -907,7 +941,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
907
941
  while (1) switch (_context15.prev = _context15.next) {
908
942
  case 0:
909
943
  if (!_this5.isFailbackRequired()) {
910
- _context15.next = 12;
944
+ _context15.next = 13;
911
945
  break;
912
946
  }
913
947
  _context15.next = 1;
@@ -915,70 +949,67 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
915
949
  case 1:
916
950
  primaryServerStatus = _context15.sent;
917
951
  if (!((0, _keys.default)(_this5.callManager.getActiveCalls()).length === 0 && primaryServerStatus)) {
918
- _context15.next = 11;
952
+ _context15.next = 12;
919
953
  break;
920
954
  }
921
- _Logger.default.info("Attempting failback to primary.", {
922
- file: _constants2.REGISTRATION_FILE,
923
- method: _this5.executeFailback.name
924
- });
955
+ _Logger.default.info("Attempting failback to primary.", loggerContext);
925
956
  _context15.next = 2;
926
957
  return _this5.deregister();
927
958
  case 2:
928
959
  if (!_this5.apiRequest.isSocketEnabled()) {
929
- _context15.next = 3;
960
+ _context15.next = 4;
930
961
  break;
931
962
  }
963
+ _Logger.default.info('Disconnecting from backup Mobius socket for failback to primary', loggerContext);
932
964
  _context15.next = 3;
933
965
  return _this5.apiRequest.disconnectFromMobiusSocket({
934
966
  code: 3050,
935
967
  reason: 'done (permanent)'
936
968
  });
937
969
  case 3:
938
- _context15.next = 4;
939
- return _this5.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
970
+ _Logger.default.log('Mobius socket disconnect complete prior to primary failback', loggerContext);
940
971
  case 4:
972
+ _context15.next = 5;
973
+ return _this5.attemptRegistrationWithServers(_constants2.FAILBACK_UTIL);
974
+ case 5:
941
975
  abort = _context15.sent;
942
976
  if (!(_this5.scheduled429Retry || abort || _this5.isDeviceRegistered())) {
943
- _context15.next = 5;
977
+ _context15.next = 6;
944
978
  break;
945
979
  }
946
980
  return _context15.abrupt("return");
947
- case 5:
948
- _context15.next = 6;
949
- return _this5.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
950
981
  case 6:
982
+ _context15.next = 7;
983
+ return _this5.restorePreviousRegistration(_constants2.FAILBACK_UTIL);
984
+ case 7:
951
985
  abortNew = _context15.sent;
952
986
  if (!abortNew) {
953
- _context15.next = 7;
987
+ _context15.next = 8;
954
988
  break;
955
989
  }
956
990
  _this5.clearFailbackTimer();
957
991
  return _context15.abrupt("return");
958
- case 7:
992
+ case 8:
959
993
  if (_this5.isDeviceRegistered()) {
960
- _context15.next = 9;
994
+ _context15.next = 10;
961
995
  break;
962
996
  }
963
- _context15.next = 8;
964
- return _this5.restartRegistration(_this5.executeFailback.name);
965
- case 8:
966
- _context15.next = 10;
967
- break;
997
+ _context15.next = 9;
998
+ return _this5.restartRegistration(loggerContext.method);
968
999
  case 9:
1000
+ _context15.next = 11;
1001
+ break;
1002
+ case 10:
969
1003
  _this5.failbackTimer = undefined;
970
1004
  _this5.initiateFailback();
971
- case 10:
972
- _context15.next = 12;
973
- break;
974
1005
  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
- });
1006
+ _context15.next = 13;
1007
+ break;
1008
+ case 12:
1009
+ _Logger.default.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', loggerContext);
979
1010
  _this5.failbackTimer = undefined;
980
1011
  _this5.initiateFailback();
981
- case 12:
1012
+ case 13:
982
1013
  case "end":
983
1014
  return _context15.stop();
984
1015
  }
@@ -1052,10 +1083,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1052
1083
  key: "restartRegistration",
1053
1084
  value: (function () {
1054
1085
  var _restartRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(caller) {
1055
- var abort;
1086
+ var loggerContext, abort;
1056
1087
  return _regenerator.default.wrap(function (_context17) {
1057
1088
  while (1) switch (_context17.prev = _context17.next) {
1058
1089
  case 0:
1090
+ loggerContext = {
1091
+ file: _constants2.REGISTRATION_FILE,
1092
+ method: _constants2.METHODS.RESTART_REGISTRATION
1093
+ };
1094
+ _Logger.default.info("".concat(_constants.METHOD_START_MESSAGE, " - caller: ").concat(caller), loggerContext);
1095
+
1059
1096
  /*
1060
1097
  * Cancel any failback timer running
1061
1098
  * and start fresh registration attempt with retry as true.
@@ -1073,6 +1110,8 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1073
1110
  _context17.next = 2;
1074
1111
  return this.startFailoverTimer();
1075
1112
  case 2:
1113
+ _Logger.default.log("restartRegistration completed - caller: ".concat(caller, ", deviceRegistered: ").concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
1114
+ case 3:
1076
1115
  case "end":
1077
1116
  return _context17.stop();
1078
1117
  }
@@ -1229,10 +1268,15 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1229
1268
  key: "triggerRegistration",
1230
1269
  value: (function () {
1231
1270
  var _triggerRegistration = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
1232
- var abort;
1271
+ var loggerContext, abort;
1233
1272
  return _regenerator.default.wrap(function (_context21) {
1234
1273
  while (1) switch (_context21.prev = _context21.next) {
1235
1274
  case 0:
1275
+ loggerContext = {
1276
+ file: _constants2.REGISTRATION_FILE,
1277
+ method: _constants2.METHODS.TRIGGER_REGISTRATION
1278
+ };
1279
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
1236
1280
  _context21.next = 1;
1237
1281
  return this.resumeFailover();
1238
1282
  case 1:
@@ -1240,10 +1284,11 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1240
1284
  _context21.next = 2;
1241
1285
  break;
1242
1286
  }
1287
+ _Logger.default.info('Registration trigger handled by resumeFailover path', loggerContext);
1243
1288
  return _context21.abrupt("return");
1244
1289
  case 2:
1245
1290
  if (!(this.primaryMobiusUris.length > 0)) {
1246
- _context21.next = 4;
1291
+ _context21.next = 5;
1247
1292
  break;
1248
1293
  }
1249
1294
  _context21.next = 3;
@@ -1257,6 +1302,12 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1257
1302
  _context21.next = 4;
1258
1303
  return this.startFailoverTimer();
1259
1304
  case 4:
1305
+ _Logger.default.log("triggerRegistration completed - deviceRegistered: ".concat(this.isDeviceRegistered(), ", abort: ").concat(abort), loggerContext);
1306
+ _context21.next = 6;
1307
+ break;
1308
+ case 5:
1309
+ _Logger.default.warn('triggerRegistration skipped: no primary Mobius URIs available', loggerContext);
1310
+ case 6:
1260
1311
  case "end":
1261
1312
  return _context21.stop();
1262
1313
  }
@@ -1282,6 +1333,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1282
1333
  var _attemptRegistrationWithServers = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22(caller) {
1283
1334
  var _this8 = this;
1284
1335
  var servers,
1336
+ loggerContext,
1285
1337
  abort,
1286
1338
  connectedWebSocketUrl,
1287
1339
  _iterator2,
@@ -1294,6 +1346,10 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1294
1346
  while (1) switch (_context23.prev = _context23.next) {
1295
1347
  case 0:
1296
1348
  servers = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : this.primaryMobiusUris;
1349
+ loggerContext = {
1350
+ file: _constants2.REGISTRATION_FILE,
1351
+ method: _constants2.REGISTER_UTIL
1352
+ };
1297
1353
  abort = false;
1298
1354
  this.retryAfter = undefined;
1299
1355
  if (!this.failoverImmediately) {
@@ -1306,10 +1362,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1306
1362
  _context23.next = 2;
1307
1363
  break;
1308
1364
  }
1309
- _Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), {
1310
- file: _constants2.REGISTRATION_FILE,
1311
- method: _constants2.REGISTER_UTIL
1312
- });
1365
+ _Logger.default.info("[".concat(caller, "] : Device already registered with : ").concat(this.activeMobiusUrl), loggerContext);
1313
1366
  return _context23.abrupt("return", abort);
1314
1367
  case 2:
1315
1368
  _iterator2 = _createForOfIteratorHelper(servers);
@@ -1326,20 +1379,21 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1326
1379
  abort = false;
1327
1380
  _this8.registrationStatus = _types2.RegistrationStatus.INACTIVE;
1328
1381
  _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
- });
1382
+ _Logger.default.info("[".concat(caller, "] : Mobius url to contact: ").concat(url), loggerContext);
1333
1383
  if (!_this8.apiRequest.isSocketEnabled()) {
1334
1384
  _context22.next = 3;
1335
1385
  break;
1336
1386
  }
1337
- wssNormalizedUrl = url.endsWith('/') ? url.slice(0, -1) : url; // eslint-disable-next-line no-await-in-loop
1387
+ wssNormalizedUrl = url.endsWith('/') ? url.slice(0, -1) : url;
1388
+ _Logger.default.info("[".concat(caller, "] : Connecting to Mobius WebSocket - serverType: ").concat(serverType, ", wssUrl: ").concat(wssNormalizedUrl), loggerContext);
1389
+
1390
+ // eslint-disable-next-line no-await-in-loop
1338
1391
  _context22.next = 2;
1339
1392
  return _this8.apiRequest.connectToMobiusSocket(wssNormalizedUrl);
1340
1393
  case 2:
1341
1394
  connectedWebSocketUrl = _context22.sent;
1342
1395
  connectedWebSocketUrl = connectedWebSocketUrl ? "".concat(connectedWebSocketUrl, "/") : undefined;
1396
+ _Logger.default.log("[".concat(caller, "] : Mobius WebSocket connected - serverType: ").concat(serverType, ", connectedWebSocketUrl: ").concat(connectedWebSocketUrl), loggerContext);
1343
1397
  case 3:
1344
1398
  _context22.next = 4;
1345
1399
  return _this8.postRegistration(url);
@@ -1350,10 +1404,7 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1350
1404
  _this8.registrationStatus = _types2.RegistrationStatus.ACTIVE;
1351
1405
  _this8.setActiveMobiusUrl(connectedWebSocketUrl || url);
1352
1406
  _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
- });
1407
+ _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
1408
  _this8.setIntervalValues(_this8.deviceInfo);
1358
1409
  _this8.metricManager.setDeviceInfo(_this8.deviceInfo);
1359
1410
  _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 +1439,16 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1388
1439
  _context22.next = 7;
1389
1440
  break;
1390
1441
  }
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
- });
1442
+ _Logger.default.info("[".concat(caller, "] : Device is already restored, active mobius url: ").concat(_this8.activeMobiusUrl), loggerContext);
1395
1443
  return _context22.abrupt("return", 0);
1396
1444
  case 7:
1397
1445
  if (!(shouldDisconnect && _this8.apiRequest.isSocketEnabled())) {
1398
- _context22.next = 8;
1446
+ _context22.next = 9;
1399
1447
  break;
1400
1448
  }
1401
1449
  connectedWebSocketUrl = undefined;
1450
+ _Logger.default.info("[".concat(caller, "] : Tearing down Mobius WebSocket after registration error - serverType: ").concat(serverType), loggerContext);
1451
+
1402
1452
  // eslint-disable-next-line no-await-in-loop
1403
1453
  _context22.next = 8;
1404
1454
  return _this8.apiRequest.disconnectFromMobiusSocket({
@@ -1406,17 +1456,19 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1406
1456
  reason: 'done (permanent)'
1407
1457
  });
1408
1458
  case 8:
1459
+ _Logger.default.log("[".concat(caller, "] : Mobius WebSocket disconnect complete after registration error - serverType: ").concat(serverType), loggerContext);
1460
+ case 9:
1409
1461
  if (!abort) {
1410
- _context22.next = 10;
1462
+ _context22.next = 11;
1411
1463
  break;
1412
1464
  }
1413
1465
  _this8.setStatus(_types2.RegistrationStatus.INACTIVE);
1414
1466
  // eslint-disable-next-line no-await-in-loop
1415
- _context22.next = 9;
1467
+ _context22.next = 10;
1416
1468
  return (0, _common.uploadLogs)();
1417
- case 9:
1418
- return _context22.abrupt("return", 0);
1419
1469
  case 10:
1470
+ return _context22.abrupt("return", 0);
1471
+ case 11:
1420
1472
  case "end":
1421
1473
  return _context22.stop();
1422
1474
  }
@@ -1649,36 +1701,35 @@ var Registration = exports.Registration = /*#__PURE__*/function () {
1649
1701
  key: "deregister",
1650
1702
  value: function () {
1651
1703
  var _deregister = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
1652
- var _this$deviceInfo$devi2, _this$deviceInfo$devi3, _t8;
1704
+ var loggerContext, _this$deviceInfo$devi2, _this$deviceInfo$devi3, _t8;
1653
1705
  return _regenerator.default.wrap(function (_context27) {
1654
1706
  while (1) switch (_context27.prev = _context27.next) {
1655
1707
  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', {
1708
+ loggerContext = {
1661
1709
  file: _constants2.REGISTRATION_FILE,
1662
1710
  method: _constants2.METHODS.DEREGISTER
1663
- });
1664
- _context27.next = 3;
1665
- break;
1711
+ };
1712
+ _Logger.default.info(_constants.METHOD_START_MESSAGE, loggerContext);
1713
+ _context27.prev = 1;
1714
+ _context27.next = 2;
1715
+ 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
1716
  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
- });
1717
+ _Logger.default.log('Registration successfully deregistered', loggerContext);
1718
+ _context27.next = 4;
1719
+ break;
1673
1720
  case 3:
1721
+ _context27.prev = 3;
1722
+ _t8 = _context27["catch"](1);
1723
+ _Logger.default.warn("Delete failed with Mobius: ".concat((0, _stringify.default)(_t8)), loggerContext);
1724
+ case 4:
1674
1725
  this.clearKeepaliveTimer();
1675
1726
  this.setStatus(_types2.RegistrationStatus.INACTIVE);
1676
1727
  this.clearFailoverState();
1677
- case 4:
1728
+ case 5:
1678
1729
  case "end":
1679
1730
  return _context27.stop();
1680
1731
  }
1681
- }, _callee26, this, [[0, 2]]);
1732
+ }, _callee26, this, [[1, 3]]);
1682
1733
  }));
1683
1734
  function deregister() {
1684
1735
  return _deregister.apply(this, arguments);