@aws-amplify/pubsub 4.2.6-custom-pk.97 → 4.2.6-custom-pk.156
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/CHANGELOG.md +51 -93
- package/dist/aws-amplify-pubsub.js +552 -152
- package/dist/aws-amplify-pubsub.js.map +1 -1
- package/dist/aws-amplify-pubsub.min.js +2 -2
- package/dist/aws-amplify-pubsub.min.js.map +1 -1
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +5 -2
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +48 -19
- package/lib/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
- package/lib/Providers/MqttOverWSProvider.d.ts +3 -1
- package/lib/Providers/MqttOverWSProvider.js +22 -1
- package/lib/Providers/MqttOverWSProvider.js.map +1 -1
- package/lib/Providers/PubSubProvider.d.ts +1 -1
- package/lib/Providers/{AWSAppSyncRealTimeProvider/constants.d.ts → constants.d.ts} +5 -0
- package/lib/Providers/{AWSAppSyncRealTimeProvider/constants.js → constants.js} +5 -0
- package/lib/Providers/constants.js.map +1 -0
- package/lib/index.d.ts +3 -8
- package/lib/index.js +5 -9
- package/lib/index.js.map +1 -1
- package/lib/types/Provider.d.ts +10 -1
- package/lib/types/PubSub.d.ts +22 -8
- package/lib/types/PubSub.js +56 -0
- package/lib/types/PubSub.js.map +1 -1
- package/lib/types/index.d.ts +0 -6
- package/lib/types/index.js +4 -0
- package/lib/types/index.js.map +1 -1
- package/lib/utils/ConnectionStateMonitor.d.ts +40 -0
- package/lib/utils/ConnectionStateMonitor.js +157 -0
- package/lib/utils/ConnectionStateMonitor.js.map +1 -0
- package/lib/utils/ReachabilityMonitor/index.d.ts +3 -0
- package/lib/utils/ReachabilityMonitor/index.js +5 -0
- package/lib/utils/ReachabilityMonitor/index.js.map +1 -0
- package/lib/utils/ReachabilityMonitor/index.native.d.ts +3 -0
- package/lib/utils/ReachabilityMonitor/index.native.js +11 -0
- package/lib/utils/ReachabilityMonitor/index.native.js.map +1 -0
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +5 -2
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +42 -13
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
- package/lib-esm/Providers/MqttOverWSProvider.d.ts +3 -1
- package/lib-esm/Providers/MqttOverWSProvider.js +23 -2
- package/lib-esm/Providers/MqttOverWSProvider.js.map +1 -1
- package/lib-esm/Providers/PubSubProvider.d.ts +1 -1
- package/lib-esm/Providers/{AWSAppSyncRealTimeProvider/constants.d.ts → constants.d.ts} +5 -0
- package/lib-esm/Providers/{AWSAppSyncRealTimeProvider/constants.js → constants.js} +5 -0
- package/lib-esm/Providers/constants.js.map +1 -0
- package/lib-esm/index.d.ts +3 -8
- package/lib-esm/index.js +3 -9
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/types/Provider.d.ts +10 -1
- package/lib-esm/types/PubSub.d.ts +22 -8
- package/lib-esm/types/PubSub.js +56 -0
- package/lib-esm/types/PubSub.js.map +1 -1
- package/lib-esm/types/index.d.ts +0 -6
- package/lib-esm/types/index.js +1 -0
- package/lib-esm/types/index.js.map +1 -1
- package/lib-esm/utils/ConnectionStateMonitor.d.ts +40 -0
- package/lib-esm/utils/ConnectionStateMonitor.js +152 -0
- package/lib-esm/utils/ConnectionStateMonitor.js.map +1 -0
- package/lib-esm/utils/ReachabilityMonitor/index.d.ts +3 -0
- package/lib-esm/utils/ReachabilityMonitor/index.js +3 -0
- package/lib-esm/utils/ReachabilityMonitor/index.js.map +1 -0
- package/lib-esm/utils/ReachabilityMonitor/index.native.d.ts +3 -0
- package/lib-esm/utils/ReachabilityMonitor/index.native.js +6 -0
- package/lib-esm/utils/ReachabilityMonitor/index.native.js.map +1 -0
- package/package.json +5 -5
- package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +69 -16
- package/src/Providers/MqttOverWSProvider.ts +44 -3
- package/src/Providers/PubSubProvider.ts +1 -1
- package/src/Providers/{AWSAppSyncRealTimeProvider/constants.ts → constants.ts} +7 -0
- package/src/index.ts +4 -8
- package/src/types/Provider.ts +13 -1
- package/src/types/PubSub.ts +47 -8
- package/src/types/index.ts +0 -7
- package/src/utils/ConnectionStateMonitor.ts +192 -0
- package/src/utils/ReachabilityMonitor/index.native.ts +5 -0
- package/src/utils/ReachabilityMonitor/index.ts +3 -0
- package/lib/Providers/AWSAppSyncRealTimeProvider/constants.js.map +0 -1
- package/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js.map +0 -1
|
@@ -7612,131 +7612,6 @@ function (_super) {
|
|
|
7612
7612
|
|
|
7613
7613
|
|
|
7614
7614
|
|
|
7615
|
-
/***/ }),
|
|
7616
|
-
|
|
7617
|
-
/***/ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js":
|
|
7618
|
-
/*!*******************************************************************!*\
|
|
7619
|
-
!*** ./lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js ***!
|
|
7620
|
-
\*******************************************************************/
|
|
7621
|
-
/*! exports provided: MAX_DELAY_MS, NON_RETRYABLE_CODES, MESSAGE_TYPES, SUBSCRIPTION_STATUS, SOCKET_STATUS, AMPLIFY_SYMBOL, AWS_APPSYNC_REALTIME_HEADERS, CONNECTION_INIT_TIMEOUT, START_ACK_TIMEOUT, DEFAULT_KEEP_ALIVE_TIMEOUT */
|
|
7622
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7623
|
-
|
|
7624
|
-
"use strict";
|
|
7625
|
-
__webpack_require__.r(__webpack_exports__);
|
|
7626
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_DELAY_MS", function() { return MAX_DELAY_MS; });
|
|
7627
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NON_RETRYABLE_CODES", function() { return NON_RETRYABLE_CODES; });
|
|
7628
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGE_TYPES", function() { return MESSAGE_TYPES; });
|
|
7629
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SUBSCRIPTION_STATUS", function() { return SUBSCRIPTION_STATUS; });
|
|
7630
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOCKET_STATUS", function() { return SOCKET_STATUS; });
|
|
7631
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMPLIFY_SYMBOL", function() { return AMPLIFY_SYMBOL; });
|
|
7632
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_APPSYNC_REALTIME_HEADERS", function() { return AWS_APPSYNC_REALTIME_HEADERS; });
|
|
7633
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_INIT_TIMEOUT", function() { return CONNECTION_INIT_TIMEOUT; });
|
|
7634
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "START_ACK_TIMEOUT", function() { return START_ACK_TIMEOUT; });
|
|
7635
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_TIMEOUT; });
|
|
7636
|
-
var MAX_DELAY_MS = 5000;
|
|
7637
|
-
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
7638
|
-
var MESSAGE_TYPES;
|
|
7639
|
-
|
|
7640
|
-
(function (MESSAGE_TYPES) {
|
|
7641
|
-
/**
|
|
7642
|
-
* Client -> Server message.
|
|
7643
|
-
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
7644
|
-
*/
|
|
7645
|
-
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
7646
|
-
/**
|
|
7647
|
-
* Server -> Client message
|
|
7648
|
-
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
7649
|
-
*/
|
|
7650
|
-
|
|
7651
|
-
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
7652
|
-
/**
|
|
7653
|
-
* Server -> Client message.
|
|
7654
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
7655
|
-
*/
|
|
7656
|
-
|
|
7657
|
-
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
7658
|
-
/**
|
|
7659
|
-
* Client -> Server message.
|
|
7660
|
-
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
7661
|
-
*/
|
|
7662
|
-
|
|
7663
|
-
MESSAGE_TYPES["GQL_START"] = "start";
|
|
7664
|
-
/**
|
|
7665
|
-
* Server -> Client message.
|
|
7666
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
7667
|
-
*/
|
|
7668
|
-
|
|
7669
|
-
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
7670
|
-
/**
|
|
7671
|
-
* Server -> Client message.
|
|
7672
|
-
* This message type is for subscription message from AWS AppSync RealTime
|
|
7673
|
-
*/
|
|
7674
|
-
|
|
7675
|
-
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
7676
|
-
/**
|
|
7677
|
-
* Server -> Client message.
|
|
7678
|
-
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
7679
|
-
*/
|
|
7680
|
-
|
|
7681
|
-
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
7682
|
-
/**
|
|
7683
|
-
* Client -> Server message.
|
|
7684
|
-
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
7685
|
-
*/
|
|
7686
|
-
|
|
7687
|
-
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
7688
|
-
/**
|
|
7689
|
-
* Server -> Client message.
|
|
7690
|
-
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
7691
|
-
*/
|
|
7692
|
-
|
|
7693
|
-
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
7694
|
-
/**
|
|
7695
|
-
* Server -> Client message.
|
|
7696
|
-
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
7697
|
-
*/
|
|
7698
|
-
|
|
7699
|
-
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
7700
|
-
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
7701
|
-
|
|
7702
|
-
var SUBSCRIPTION_STATUS;
|
|
7703
|
-
|
|
7704
|
-
(function (SUBSCRIPTION_STATUS) {
|
|
7705
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
7706
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
7707
|
-
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
7708
|
-
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
7709
|
-
|
|
7710
|
-
var SOCKET_STATUS;
|
|
7711
|
-
|
|
7712
|
-
(function (SOCKET_STATUS) {
|
|
7713
|
-
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
7714
|
-
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
7715
|
-
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
7716
|
-
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
7717
|
-
|
|
7718
|
-
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
7719
|
-
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
7720
|
-
accept: 'application/json, text/javascript',
|
|
7721
|
-
'content-encoding': 'amz-1.0',
|
|
7722
|
-
'content-type': 'application/json; charset=UTF-8'
|
|
7723
|
-
};
|
|
7724
|
-
/**
|
|
7725
|
-
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
7726
|
-
*/
|
|
7727
|
-
|
|
7728
|
-
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
7729
|
-
/**
|
|
7730
|
-
* Time in milleseconds to wait for GQL_START_ACK message
|
|
7731
|
-
*/
|
|
7732
|
-
|
|
7733
|
-
var START_ACK_TIMEOUT = 15000;
|
|
7734
|
-
/**
|
|
7735
|
-
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
7736
|
-
*/
|
|
7737
|
-
|
|
7738
|
-
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
7739
|
-
|
|
7740
7615
|
/***/ }),
|
|
7741
7616
|
|
|
7742
7617
|
/***/ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js":
|
|
@@ -7765,8 +7640,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7765
7640
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
|
|
7766
7641
|
/* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__);
|
|
7767
7642
|
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PubSubProvider */ "./lib-esm/Providers/PubSubProvider.js");
|
|
7768
|
-
/* harmony import */ var
|
|
7769
|
-
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*!
|
|
7643
|
+
/* harmony import */ var _types_PubSub__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../types/PubSub */ "./lib-esm/types/PubSub.js");
|
|
7644
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../constants */ "./lib-esm/Providers/constants.js");
|
|
7645
|
+
/* harmony import */ var _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utils/ConnectionStateMonitor */ "./lib-esm/utils/ConnectionStateMonitor.js");
|
|
7770
7646
|
var __extends = undefined && undefined.__extends || function () {
|
|
7771
7647
|
var _extendStatics = function extendStatics(d, b) {
|
|
7772
7648
|
_extendStatics = Object.setPrototypeOf || {
|
|
@@ -8003,6 +7879,7 @@ var __read = undefined && undefined.__read || function (o, n) {
|
|
|
8003
7879
|
|
|
8004
7880
|
|
|
8005
7881
|
|
|
7882
|
+
|
|
8006
7883
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_5__["Logger"]('AWSAppSyncRealTimeProvider');
|
|
8007
7884
|
|
|
8008
7885
|
var dispatchApiEvent = function dispatchApiEvent(event, data, message) {
|
|
@@ -8021,13 +7898,26 @@ var AWSAppSyncRealTimeProvider =
|
|
|
8021
7898
|
function (_super) {
|
|
8022
7899
|
__extends(AWSAppSyncRealTimeProvider, _super);
|
|
8023
7900
|
|
|
8024
|
-
function AWSAppSyncRealTimeProvider() {
|
|
8025
|
-
|
|
7901
|
+
function AWSAppSyncRealTimeProvider(options) {
|
|
7902
|
+
if (options === void 0) {
|
|
7903
|
+
options = {};
|
|
7904
|
+
}
|
|
7905
|
+
|
|
7906
|
+
var _this = _super.call(this, options) || this;
|
|
8026
7907
|
|
|
8027
7908
|
_this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8028
7909
|
_this.keepAliveTimeout = _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_TIMEOUT"];
|
|
8029
7910
|
_this.subscriptionObserverMap = new Map();
|
|
8030
7911
|
_this.promiseArray = [];
|
|
7912
|
+
_this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["ConnectionStateMonitor"](); // Monitor the connection state and pass changes along to Hub
|
|
7913
|
+
|
|
7914
|
+
_this.connectionStateMonitor.connectionStateObservable.subscribe(function (ConnectionState) {
|
|
7915
|
+
dispatchApiEvent(_constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_STATE_CHANGE"], {
|
|
7916
|
+
provider: _this,
|
|
7917
|
+
connectionState: ConnectionState
|
|
7918
|
+
}, "Connection state is " + ConnectionState);
|
|
7919
|
+
});
|
|
7920
|
+
|
|
8031
7921
|
return _this;
|
|
8032
7922
|
}
|
|
8033
7923
|
|
|
@@ -8075,8 +7965,11 @@ function (_super) {
|
|
|
8075
7965
|
subscriptionId: subscriptionId_1
|
|
8076
7966
|
})["catch"](function (err) {
|
|
8077
7967
|
observer.error({
|
|
8078
|
-
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](
|
|
7968
|
+
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].REALTIME_SUBSCRIPTION_INIT_ERROR + ": " + err))]
|
|
8079
7969
|
});
|
|
7970
|
+
|
|
7971
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
7972
|
+
|
|
8080
7973
|
observer.complete();
|
|
8081
7974
|
});
|
|
8082
7975
|
|
|
@@ -8221,6 +8114,7 @@ function (_super) {
|
|
|
8221
8114
|
case 3:
|
|
8222
8115
|
_k.trys.push([3, 5,, 6]);
|
|
8223
8116
|
|
|
8117
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].OPENING_CONNECTION);
|
|
8224
8118
|
return [4
|
|
8225
8119
|
/*yield*/
|
|
8226
8120
|
, this._initializeWebSocketConnection({
|
|
@@ -8244,8 +8138,9 @@ function (_super) {
|
|
|
8244
8138
|
err: err_2
|
|
8245
8139
|
});
|
|
8246
8140
|
message = (_b = err_2['message']) !== null && _b !== void 0 ? _b : '';
|
|
8141
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
8247
8142
|
observer.error({
|
|
8248
|
-
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](
|
|
8143
|
+
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_FAILED + ": " + message))]
|
|
8249
8144
|
});
|
|
8250
8145
|
observer.complete();
|
|
8251
8146
|
subscriptionFailedCallback_1 = (this.subscriptionObserverMap.get(subscriptionId) || {}).subscriptionFailedCallback; // Notify concurrent unsubscription
|
|
@@ -8362,12 +8257,22 @@ function (_super) {
|
|
|
8362
8257
|
return;
|
|
8363
8258
|
}
|
|
8364
8259
|
|
|
8260
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
|
|
8261
|
+
|
|
8365
8262
|
if (this.awsRealTimeSocket.bufferedAmount > 0) {
|
|
8366
8263
|
// Still data on the WebSocket
|
|
8367
8264
|
setTimeout(this._closeSocketIfRequired.bind(this), 1000);
|
|
8368
8265
|
} else {
|
|
8369
8266
|
logger.debug('closing WebSocket...');
|
|
8370
|
-
|
|
8267
|
+
|
|
8268
|
+
if (this.keepAliveTimeoutId) {
|
|
8269
|
+
clearTimeout(this.keepAliveTimeoutId);
|
|
8270
|
+
}
|
|
8271
|
+
|
|
8272
|
+
if (this.keepAliveAlertTimeoutId) {
|
|
8273
|
+
clearTimeout(this.keepAliveAlertTimeoutId);
|
|
8274
|
+
}
|
|
8275
|
+
|
|
8371
8276
|
var tempSocket = this.awsRealTimeSocket; // Cleaning callbacks to avoid race condition, socket still exists
|
|
8372
8277
|
|
|
8373
8278
|
tempSocket.onclose = null;
|
|
@@ -8375,10 +8280,13 @@ function (_super) {
|
|
|
8375
8280
|
tempSocket.close(1000);
|
|
8376
8281
|
this.awsRealTimeSocket = undefined;
|
|
8377
8282
|
this.socketStatus = _constants__WEBPACK_IMPORTED_MODULE_10__["SOCKET_STATUS"].CLOSED;
|
|
8283
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
8378
8284
|
}
|
|
8379
8285
|
};
|
|
8380
8286
|
|
|
8381
8287
|
AWSAppSyncRealTimeProvider.prototype._handleIncomingSubscriptionMessage = function (message) {
|
|
8288
|
+
var _this = this;
|
|
8289
|
+
|
|
8382
8290
|
logger.debug("subscription message from AWS AppSync RealTime: " + message.data);
|
|
8383
8291
|
|
|
8384
8292
|
var _a = JSON.parse(message.data),
|
|
@@ -8426,7 +8334,7 @@ function (_super) {
|
|
|
8426
8334
|
}
|
|
8427
8335
|
|
|
8428
8336
|
if (startAckTimeoutId) clearTimeout(startAckTimeoutId);
|
|
8429
|
-
dispatchApiEvent(
|
|
8337
|
+
dispatchApiEvent(_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].SUBSCRIPTION_ACK, {
|
|
8430
8338
|
query: query,
|
|
8431
8339
|
variables: variables
|
|
8432
8340
|
}, 'Connection established for subscription');
|
|
@@ -8442,15 +8350,22 @@ function (_super) {
|
|
|
8442
8350
|
subscriptionReadyCallback: subscriptionReadyCallback,
|
|
8443
8351
|
subscriptionFailedCallback: subscriptionFailedCallback
|
|
8444
8352
|
});
|
|
8445
|
-
}
|
|
8446
|
-
|
|
8353
|
+
}
|
|
8447
8354
|
|
|
8355
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
|
|
8448
8356
|
return;
|
|
8449
8357
|
}
|
|
8450
8358
|
|
|
8451
8359
|
if (type === _constants__WEBPACK_IMPORTED_MODULE_10__["MESSAGE_TYPES"].GQL_CONNECTION_KEEP_ALIVE) {
|
|
8452
8360
|
if (this.keepAliveTimeoutId) clearTimeout(this.keepAliveTimeoutId);
|
|
8453
|
-
|
|
8361
|
+
if (this.keepAliveAlertTimeoutId) clearTimeout(this.keepAliveAlertTimeoutId);
|
|
8362
|
+
this.keepAliveTimeoutId = setTimeout(function () {
|
|
8363
|
+
return _this._errorDisconnect(_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].TIMEOUT_DISCONNECT);
|
|
8364
|
+
}, this.keepAliveTimeout);
|
|
8365
|
+
this.keepAliveAlertTimeoutId = setTimeout(function () {
|
|
8366
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].KEEP_ALIVE_MISSED);
|
|
8367
|
+
}, _constants__WEBPACK_IMPORTED_MODULE_10__["DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT"]);
|
|
8368
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].KEEP_ALIVE);
|
|
8454
8369
|
return;
|
|
8455
8370
|
}
|
|
8456
8371
|
|
|
@@ -8468,7 +8383,7 @@ function (_super) {
|
|
|
8468
8383
|
subscriptionState: subscriptionState
|
|
8469
8384
|
});
|
|
8470
8385
|
observer.error({
|
|
8471
|
-
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](
|
|
8386
|
+
errors: [__assign({}, new graphql__WEBPACK_IMPORTED_MODULE_1__["GraphQLError"](_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_FAILED + ": " + JSON.stringify(payload)))]
|
|
8472
8387
|
});
|
|
8473
8388
|
if (startAckTimeoutId) clearTimeout(startAckTimeoutId);
|
|
8474
8389
|
observer.complete();
|
|
@@ -8494,6 +8409,7 @@ function (_super) {
|
|
|
8494
8409
|
this.subscriptionObserverMap.clear();
|
|
8495
8410
|
|
|
8496
8411
|
if (this.awsRealTimeSocket) {
|
|
8412
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CLOSED);
|
|
8497
8413
|
this.awsRealTimeSocket.close();
|
|
8498
8414
|
}
|
|
8499
8415
|
|
|
@@ -8692,6 +8608,8 @@ function (_super) {
|
|
|
8692
8608
|
};
|
|
8693
8609
|
|
|
8694
8610
|
newSocket.onclose = function () {
|
|
8611
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
8612
|
+
|
|
8695
8613
|
rej(new Error('Connection handshake error'));
|
|
8696
8614
|
};
|
|
8697
8615
|
|
|
@@ -8740,13 +8658,13 @@ function (_super) {
|
|
|
8740
8658
|
_this.awsRealTimeSocket.onerror = function (err) {
|
|
8741
8659
|
logger.debug(err);
|
|
8742
8660
|
|
|
8743
|
-
_this._errorDisconnect(
|
|
8661
|
+
_this._errorDisconnect(_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_CLOSED);
|
|
8744
8662
|
};
|
|
8745
8663
|
|
|
8746
8664
|
_this.awsRealTimeSocket.onclose = function (event) {
|
|
8747
8665
|
logger.debug("WebSocket closed " + event.reason);
|
|
8748
8666
|
|
|
8749
|
-
_this._errorDisconnect(
|
|
8667
|
+
_this._errorDisconnect(_types_PubSub__WEBPACK_IMPORTED_MODULE_9__["CONTROL_MSG"].CONNECTION_CLOSED);
|
|
8750
8668
|
};
|
|
8751
8669
|
}
|
|
8752
8670
|
|
|
@@ -8778,13 +8696,17 @@ function (_super) {
|
|
|
8778
8696
|
|
|
8779
8697
|
_this.awsRealTimeSocket.send(JSON.stringify(gqlInit));
|
|
8780
8698
|
|
|
8781
|
-
|
|
8782
|
-
|
|
8699
|
+
var checkAckOk_1 = function checkAckOk_1(ackOk) {
|
|
8700
|
+
if (!ackOk) {
|
|
8701
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
8783
8702
|
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8703
|
+
rej(new Error("Connection timeout: ack from AWSAppSyncRealTime was not received after " + _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"] + " ms"));
|
|
8704
|
+
}
|
|
8705
|
+
};
|
|
8706
|
+
|
|
8707
|
+
setTimeout(function () {
|
|
8708
|
+
return checkAckOk_1(ackOk_1);
|
|
8709
|
+
}, _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"]);
|
|
8788
8710
|
}
|
|
8789
8711
|
});
|
|
8790
8712
|
}()];
|
|
@@ -9351,6 +9273,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9351
9273
|
/* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PubSubProvider */ "./lib-esm/Providers/PubSubProvider.js");
|
|
9352
9274
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
9353
9275
|
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__);
|
|
9276
|
+
/* harmony import */ var _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/ConnectionStateMonitor */ "./lib-esm/utils/ConnectionStateMonitor.js");
|
|
9277
|
+
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ "./lib-esm/Providers/constants.js");
|
|
9354
9278
|
function _typeof(obj) {
|
|
9355
9279
|
"@babel/helpers - typeof";
|
|
9356
9280
|
|
|
@@ -9577,6 +9501,8 @@ var __rest = undefined && undefined.__rest || function (s, e) {
|
|
|
9577
9501
|
|
|
9578
9502
|
|
|
9579
9503
|
|
|
9504
|
+
|
|
9505
|
+
|
|
9580
9506
|
var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["ConsoleLogger"]('MqttOverWSProvider');
|
|
9581
9507
|
function mqttTopicMatch(filter, topic) {
|
|
9582
9508
|
var filterArray = filter.split('/');
|
|
@@ -9642,6 +9568,14 @@ function () {
|
|
|
9642
9568
|
return ClientsQueue;
|
|
9643
9569
|
}();
|
|
9644
9570
|
|
|
9571
|
+
var dispatchPubSubEvent = function dispatchPubSubEvent(event, data, message) {
|
|
9572
|
+
_aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["Hub"].dispatch('pubsub', {
|
|
9573
|
+
event: event,
|
|
9574
|
+
data: data,
|
|
9575
|
+
message: message
|
|
9576
|
+
}, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_6__["AMPLIFY_SYMBOL"]);
|
|
9577
|
+
};
|
|
9578
|
+
|
|
9645
9579
|
var topicSymbol = typeof Symbol !== 'undefined' ? Symbol('topic') : '@@topic';
|
|
9646
9580
|
|
|
9647
9581
|
var MqttOverWSProvider =
|
|
@@ -9659,8 +9593,17 @@ function (_super) {
|
|
|
9659
9593
|
})) || this;
|
|
9660
9594
|
|
|
9661
9595
|
_this._clientsQueue = new ClientsQueue();
|
|
9596
|
+
_this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["ConnectionStateMonitor"]();
|
|
9662
9597
|
_this._topicObservers = new Map();
|
|
9663
|
-
_this._clientIdObservers = new Map();
|
|
9598
|
+
_this._clientIdObservers = new Map(); // Monitor the connection health state and pass changes along to Hub
|
|
9599
|
+
|
|
9600
|
+
_this.connectionStateMonitor.connectionStateObservable.subscribe(function (connectionStateChange) {
|
|
9601
|
+
dispatchPubSubEvent(_constants__WEBPACK_IMPORTED_MODULE_6__["CONNECTION_STATE_CHANGE"], {
|
|
9602
|
+
provider: _this,
|
|
9603
|
+
connectionState: connectionStateChange
|
|
9604
|
+
}, "Connection state is " + connectionStateChange);
|
|
9605
|
+
});
|
|
9606
|
+
|
|
9664
9607
|
return _this;
|
|
9665
9608
|
}
|
|
9666
9609
|
|
|
@@ -9757,6 +9700,7 @@ function (_super) {
|
|
|
9757
9700
|
switch (_b.label) {
|
|
9758
9701
|
case 0:
|
|
9759
9702
|
logger.debug('Creating new MQTT client', clientId);
|
|
9703
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].OPENING_CONNECTION);
|
|
9760
9704
|
client = new paho_mqtt__WEBPACK_IMPORTED_MODULE_0__["Client"](url, clientId); // client.trace = (args) => logger.debug(clientId, JSON.stringify(args, null, 2));
|
|
9761
9705
|
|
|
9762
9706
|
client.onMessageArrived = function (_a) {
|
|
@@ -9774,6 +9718,8 @@ function (_super) {
|
|
|
9774
9718
|
clientId: clientId,
|
|
9775
9719
|
errorCode: errorCode
|
|
9776
9720
|
}, args));
|
|
9721
|
+
|
|
9722
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
|
|
9777
9723
|
};
|
|
9778
9724
|
|
|
9779
9725
|
return [4
|
|
@@ -9785,13 +9731,18 @@ function (_super) {
|
|
|
9785
9731
|
onSuccess: function onSuccess() {
|
|
9786
9732
|
return resolve(client);
|
|
9787
9733
|
},
|
|
9788
|
-
onFailure:
|
|
9734
|
+
onFailure: function onFailure() {
|
|
9735
|
+
reject();
|
|
9736
|
+
|
|
9737
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_FAILED);
|
|
9738
|
+
}
|
|
9789
9739
|
});
|
|
9790
9740
|
})];
|
|
9791
9741
|
|
|
9792
9742
|
case 1:
|
|
9793
9743
|
_b.sent();
|
|
9794
9744
|
|
|
9745
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
|
|
9795
9746
|
return [2
|
|
9796
9747
|
/*return*/
|
|
9797
9748
|
, client];
|
|
@@ -9843,6 +9794,7 @@ function (_super) {
|
|
|
9843
9794
|
|
|
9844
9795
|
if (client && client.isConnected()) {
|
|
9845
9796
|
client.disconnect();
|
|
9797
|
+
this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
|
|
9846
9798
|
}
|
|
9847
9799
|
|
|
9848
9800
|
this.clientsQueue.remove(clientId);
|
|
@@ -10023,6 +9975,8 @@ function (_super) {
|
|
|
10023
9975
|
(_a = _this._clientIdObservers.get(clientId)) === null || _a === void 0 ? void 0 : _a["delete"](observer); // No more observers per client => client not needed anymore
|
|
10024
9976
|
|
|
10025
9977
|
if (((_b = _this._clientIdObservers.get(clientId)) === null || _b === void 0 ? void 0 : _b.size) === 0) {
|
|
9978
|
+
_this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
|
|
9979
|
+
|
|
10026
9980
|
_this.disconnect(clientId);
|
|
10027
9981
|
|
|
10028
9982
|
_this._clientIdObservers["delete"](clientId);
|
|
@@ -10122,6 +10076,139 @@ function () {
|
|
|
10122
10076
|
|
|
10123
10077
|
|
|
10124
10078
|
|
|
10079
|
+
/***/ }),
|
|
10080
|
+
|
|
10081
|
+
/***/ "./lib-esm/Providers/constants.js":
|
|
10082
|
+
/*!****************************************!*\
|
|
10083
|
+
!*** ./lib-esm/Providers/constants.js ***!
|
|
10084
|
+
\****************************************/
|
|
10085
|
+
/*! exports provided: MAX_DELAY_MS, NON_RETRYABLE_CODES, CONNECTION_STATE_CHANGE, MESSAGE_TYPES, SUBSCRIPTION_STATUS, SOCKET_STATUS, AMPLIFY_SYMBOL, AWS_APPSYNC_REALTIME_HEADERS, CONNECTION_INIT_TIMEOUT, START_ACK_TIMEOUT, DEFAULT_KEEP_ALIVE_TIMEOUT, DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT */
|
|
10086
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10087
|
+
|
|
10088
|
+
"use strict";
|
|
10089
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10090
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_DELAY_MS", function() { return MAX_DELAY_MS; });
|
|
10091
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NON_RETRYABLE_CODES", function() { return NON_RETRYABLE_CODES; });
|
|
10092
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_STATE_CHANGE", function() { return CONNECTION_STATE_CHANGE; });
|
|
10093
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGE_TYPES", function() { return MESSAGE_TYPES; });
|
|
10094
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SUBSCRIPTION_STATUS", function() { return SUBSCRIPTION_STATUS; });
|
|
10095
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOCKET_STATUS", function() { return SOCKET_STATUS; });
|
|
10096
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMPLIFY_SYMBOL", function() { return AMPLIFY_SYMBOL; });
|
|
10097
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_APPSYNC_REALTIME_HEADERS", function() { return AWS_APPSYNC_REALTIME_HEADERS; });
|
|
10098
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_INIT_TIMEOUT", function() { return CONNECTION_INIT_TIMEOUT; });
|
|
10099
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "START_ACK_TIMEOUT", function() { return START_ACK_TIMEOUT; });
|
|
10100
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_TIMEOUT; });
|
|
10101
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT; });
|
|
10102
|
+
var MAX_DELAY_MS = 5000;
|
|
10103
|
+
var NON_RETRYABLE_CODES = [400, 401, 403];
|
|
10104
|
+
var CONNECTION_STATE_CHANGE = 'ConnectionStateChange';
|
|
10105
|
+
var MESSAGE_TYPES;
|
|
10106
|
+
|
|
10107
|
+
(function (MESSAGE_TYPES) {
|
|
10108
|
+
/**
|
|
10109
|
+
* Client -> Server message.
|
|
10110
|
+
* This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
|
10111
|
+
*/
|
|
10112
|
+
MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
|
10113
|
+
/**
|
|
10114
|
+
* Server -> Client message
|
|
10115
|
+
* This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
|
10116
|
+
*/
|
|
10117
|
+
|
|
10118
|
+
MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
|
10119
|
+
/**
|
|
10120
|
+
* Server -> Client message.
|
|
10121
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
|
10122
|
+
*/
|
|
10123
|
+
|
|
10124
|
+
MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
|
10125
|
+
/**
|
|
10126
|
+
* Client -> Server message.
|
|
10127
|
+
* This message type is for register subscriptions with AWS AppSync RealTime
|
|
10128
|
+
*/
|
|
10129
|
+
|
|
10130
|
+
MESSAGE_TYPES["GQL_START"] = "start";
|
|
10131
|
+
/**
|
|
10132
|
+
* Server -> Client message.
|
|
10133
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
|
10134
|
+
*/
|
|
10135
|
+
|
|
10136
|
+
MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
|
10137
|
+
/**
|
|
10138
|
+
* Server -> Client message.
|
|
10139
|
+
* This message type is for subscription message from AWS AppSync RealTime
|
|
10140
|
+
*/
|
|
10141
|
+
|
|
10142
|
+
MESSAGE_TYPES["GQL_DATA"] = "data";
|
|
10143
|
+
/**
|
|
10144
|
+
* Server -> Client message.
|
|
10145
|
+
* This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
|
10146
|
+
*/
|
|
10147
|
+
|
|
10148
|
+
MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
|
10149
|
+
/**
|
|
10150
|
+
* Client -> Server message.
|
|
10151
|
+
* This message type is for unregister subscriptions with AWS AppSync RealTime
|
|
10152
|
+
*/
|
|
10153
|
+
|
|
10154
|
+
MESSAGE_TYPES["GQL_STOP"] = "stop";
|
|
10155
|
+
/**
|
|
10156
|
+
* Server -> Client message.
|
|
10157
|
+
* This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
|
10158
|
+
*/
|
|
10159
|
+
|
|
10160
|
+
MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
|
10161
|
+
/**
|
|
10162
|
+
* Server -> Client message.
|
|
10163
|
+
* This message type is for sending error messages from AWS AppSync RealTime to the client
|
|
10164
|
+
*/
|
|
10165
|
+
|
|
10166
|
+
MESSAGE_TYPES["GQL_ERROR"] = "error";
|
|
10167
|
+
})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
|
|
10168
|
+
|
|
10169
|
+
var SUBSCRIPTION_STATUS;
|
|
10170
|
+
|
|
10171
|
+
(function (SUBSCRIPTION_STATUS) {
|
|
10172
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
|
10173
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
|
10174
|
+
SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
|
10175
|
+
})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
|
|
10176
|
+
|
|
10177
|
+
var SOCKET_STATUS;
|
|
10178
|
+
|
|
10179
|
+
(function (SOCKET_STATUS) {
|
|
10180
|
+
SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
|
10181
|
+
SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
|
10182
|
+
SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
|
10183
|
+
})(SOCKET_STATUS || (SOCKET_STATUS = {}));
|
|
10184
|
+
|
|
10185
|
+
var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
|
|
10186
|
+
var AWS_APPSYNC_REALTIME_HEADERS = {
|
|
10187
|
+
accept: 'application/json, text/javascript',
|
|
10188
|
+
'content-encoding': 'amz-1.0',
|
|
10189
|
+
'content-type': 'application/json; charset=UTF-8'
|
|
10190
|
+
};
|
|
10191
|
+
/**
|
|
10192
|
+
* Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
|
10193
|
+
*/
|
|
10194
|
+
|
|
10195
|
+
var CONNECTION_INIT_TIMEOUT = 15000;
|
|
10196
|
+
/**
|
|
10197
|
+
* Time in milleseconds to wait for GQL_START_ACK message
|
|
10198
|
+
*/
|
|
10199
|
+
|
|
10200
|
+
var START_ACK_TIMEOUT = 15000;
|
|
10201
|
+
/**
|
|
10202
|
+
* Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
10203
|
+
*/
|
|
10204
|
+
|
|
10205
|
+
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
10206
|
+
/**
|
|
10207
|
+
* Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
|
|
10208
|
+
*/
|
|
10209
|
+
|
|
10210
|
+
var DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;
|
|
10211
|
+
|
|
10125
10212
|
/***/ }),
|
|
10126
10213
|
|
|
10127
10214
|
/***/ "./lib-esm/Providers/index.js":
|
|
@@ -10555,12 +10642,11 @@ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Amplify"].register(PubSub);
|
|
|
10555
10642
|
/*!**************************!*\
|
|
10556
10643
|
!*** ./lib-esm/index.js ***!
|
|
10557
10644
|
\**************************/
|
|
10558
|
-
/*! exports provided: AbstractPubSubProvider, AWSAppSyncProvider, AWSAppSyncRealTimeProvider, AWSIoTProvider, mqttTopicMatch, MqttOverWSProvider,
|
|
10645
|
+
/*! exports provided: AbstractPubSubProvider, AWSAppSyncProvider, AWSAppSyncRealTimeProvider, AWSIoTProvider, mqttTopicMatch, MqttOverWSProvider, CONNECTION_STATE_CHANGE, ConnectionState, CONTROL_MSG, PubSub, default */
|
|
10559
10646
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10560
10647
|
|
|
10561
10648
|
"use strict";
|
|
10562
10649
|
__webpack_require__.r(__webpack_exports__);
|
|
10563
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONTROL_MSG", function() { return CONTROL_MSG; });
|
|
10564
10650
|
/* harmony import */ var _PubSub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PubSub */ "./lib-esm/PubSub.js");
|
|
10565
10651
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PubSub", function() { return _PubSub__WEBPACK_IMPORTED_MODULE_0__["PubSub"]; });
|
|
10566
10652
|
|
|
@@ -10577,6 +10663,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10577
10663
|
|
|
10578
10664
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MqttOverWSProvider", function() { return _Providers__WEBPACK_IMPORTED_MODULE_1__["MqttOverWSProvider"]; });
|
|
10579
10665
|
|
|
10666
|
+
/* harmony import */ var _Providers_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Providers/constants */ "./lib-esm/Providers/constants.js");
|
|
10667
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_STATE_CHANGE", function() { return _Providers_constants__WEBPACK_IMPORTED_MODULE_2__["CONNECTION_STATE_CHANGE"]; });
|
|
10668
|
+
|
|
10669
|
+
/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types */ "./lib-esm/types/index.js");
|
|
10670
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConnectionState", function() { return _types__WEBPACK_IMPORTED_MODULE_3__["ConnectionState"]; });
|
|
10671
|
+
|
|
10672
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CONTROL_MSG", function() { return _types__WEBPACK_IMPORTED_MODULE_3__["CONTROL_MSG"]; });
|
|
10673
|
+
|
|
10580
10674
|
/*
|
|
10581
10675
|
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
10582
10676
|
*
|
|
@@ -10591,6 +10685,40 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10591
10685
|
*/
|
|
10592
10686
|
|
|
10593
10687
|
|
|
10688
|
+
|
|
10689
|
+
|
|
10690
|
+
|
|
10691
|
+
/**
|
|
10692
|
+
* @deprecated use named import
|
|
10693
|
+
*/
|
|
10694
|
+
|
|
10695
|
+
/* harmony default export */ __webpack_exports__["default"] = (_PubSub__WEBPACK_IMPORTED_MODULE_0__["PubSub"]);
|
|
10696
|
+
|
|
10697
|
+
/***/ }),
|
|
10698
|
+
|
|
10699
|
+
/***/ "./lib-esm/types/PubSub.js":
|
|
10700
|
+
/*!*********************************!*\
|
|
10701
|
+
!*** ./lib-esm/types/PubSub.js ***!
|
|
10702
|
+
\*********************************/
|
|
10703
|
+
/*! exports provided: CONTROL_MSG, ConnectionState */
|
|
10704
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10705
|
+
|
|
10706
|
+
"use strict";
|
|
10707
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10708
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONTROL_MSG", function() { return CONTROL_MSG; });
|
|
10709
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConnectionState", function() { return ConnectionState; });
|
|
10710
|
+
/*
|
|
10711
|
+
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
10712
|
+
*
|
|
10713
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
10714
|
+
* the License. A copy of the License is located at
|
|
10715
|
+
*
|
|
10716
|
+
* http://aws.amazon.com/apache2.0/
|
|
10717
|
+
*
|
|
10718
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10719
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
10720
|
+
* and limitations under the License.
|
|
10721
|
+
*/
|
|
10594
10722
|
var CONTROL_MSG;
|
|
10595
10723
|
|
|
10596
10724
|
(function (CONTROL_MSG) {
|
|
@@ -10600,13 +10728,285 @@ var CONTROL_MSG;
|
|
|
10600
10728
|
CONTROL_MSG["SUBSCRIPTION_ACK"] = "Subscription ack";
|
|
10601
10729
|
CONTROL_MSG["TIMEOUT_DISCONNECT"] = "Timeout disconnect";
|
|
10602
10730
|
})(CONTROL_MSG || (CONTROL_MSG = {}));
|
|
10731
|
+
/** @enum {string} */
|
|
10603
10732
|
|
|
10604
10733
|
|
|
10605
|
-
|
|
10606
|
-
|
|
10734
|
+
var ConnectionState;
|
|
10735
|
+
|
|
10736
|
+
(function (ConnectionState) {
|
|
10737
|
+
/*
|
|
10738
|
+
* The connection is alive and healthy
|
|
10739
|
+
*/
|
|
10740
|
+
ConnectionState["Connected"] = "Connected";
|
|
10741
|
+
/*
|
|
10742
|
+
* The connection is alive, but the connection is offline
|
|
10743
|
+
*/
|
|
10744
|
+
|
|
10745
|
+
ConnectionState["ConnectedPendingNetwork"] = "ConnectedPendingNetwork";
|
|
10746
|
+
/*
|
|
10747
|
+
* The connection has been disconnected while in use
|
|
10748
|
+
*/
|
|
10749
|
+
|
|
10750
|
+
ConnectionState["ConnectionDisrupted"] = "ConnectionDisrupted";
|
|
10751
|
+
/*
|
|
10752
|
+
* The connection has been disconnected and the network is offline
|
|
10753
|
+
*/
|
|
10754
|
+
|
|
10755
|
+
ConnectionState["ConnectionDisruptedPendingNetwork"] = "ConnectionDisruptedPendingNetwork";
|
|
10756
|
+
/*
|
|
10757
|
+
* The connection is in the process of connecting
|
|
10758
|
+
*/
|
|
10759
|
+
|
|
10760
|
+
ConnectionState["Connecting"] = "Connecting";
|
|
10761
|
+
/*
|
|
10762
|
+
* The connection is not in use and is being disconnected
|
|
10763
|
+
*/
|
|
10764
|
+
|
|
10765
|
+
ConnectionState["ConnectedPendingDisconnect"] = "ConnectedPendingDisconnect";
|
|
10766
|
+
/*
|
|
10767
|
+
* The connection is not in use and has been disconnected
|
|
10768
|
+
*/
|
|
10769
|
+
|
|
10770
|
+
ConnectionState["Disconnected"] = "Disconnected";
|
|
10771
|
+
/*
|
|
10772
|
+
* The connection is alive, but a keep alive message has been missed
|
|
10773
|
+
*/
|
|
10774
|
+
|
|
10775
|
+
ConnectionState["ConnectedPendingKeepAlive"] = "ConnectedPendingKeepAlive";
|
|
10776
|
+
})(ConnectionState || (ConnectionState = {}));
|
|
10777
|
+
|
|
10778
|
+
/***/ }),
|
|
10779
|
+
|
|
10780
|
+
/***/ "./lib-esm/types/index.js":
|
|
10781
|
+
/*!********************************!*\
|
|
10782
|
+
!*** ./lib-esm/types/index.js ***!
|
|
10783
|
+
\********************************/
|
|
10784
|
+
/*! exports provided: CONTROL_MSG, ConnectionState */
|
|
10785
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10786
|
+
|
|
10787
|
+
"use strict";
|
|
10788
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10789
|
+
/* harmony import */ var _PubSub__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PubSub */ "./lib-esm/types/PubSub.js");
|
|
10790
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CONTROL_MSG", function() { return _PubSub__WEBPACK_IMPORTED_MODULE_0__["CONTROL_MSG"]; });
|
|
10791
|
+
|
|
10792
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConnectionState", function() { return _PubSub__WEBPACK_IMPORTED_MODULE_0__["ConnectionState"]; });
|
|
10793
|
+
|
|
10794
|
+
|
|
10795
|
+
|
|
10796
|
+
/***/ }),
|
|
10797
|
+
|
|
10798
|
+
/***/ "./lib-esm/utils/ConnectionStateMonitor.js":
|
|
10799
|
+
/*!*************************************************!*\
|
|
10800
|
+
!*** ./lib-esm/utils/ConnectionStateMonitor.js ***!
|
|
10801
|
+
\*************************************************/
|
|
10802
|
+
/*! exports provided: CONNECTION_CHANGE, ConnectionStateMonitor */
|
|
10803
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
10804
|
+
|
|
10805
|
+
"use strict";
|
|
10806
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10807
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_CHANGE", function() { return CONNECTION_CHANGE; });
|
|
10808
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConnectionStateMonitor", function() { return ConnectionStateMonitor; });
|
|
10809
|
+
/* harmony import */ var zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zen-observable-ts */ "../../node_modules/zen-observable-ts/lib/bundle.esm.js");
|
|
10810
|
+
/* harmony import */ var _types_PubSub__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types/PubSub */ "./lib-esm/types/PubSub.js");
|
|
10811
|
+
/* harmony import */ var _ReachabilityMonitor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ReachabilityMonitor */ "./lib-esm/utils/ReachabilityMonitor/index.js");
|
|
10812
|
+
/*
|
|
10813
|
+
* Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
10814
|
+
*
|
|
10815
|
+
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
|
|
10816
|
+
* the License. A copy of the License is located at
|
|
10817
|
+
*
|
|
10818
|
+
* http://aws.amazon.com/apache2.0/
|
|
10819
|
+
*
|
|
10820
|
+
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10821
|
+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
|
|
10822
|
+
* and limitations under the License.
|
|
10607
10823
|
*/
|
|
10824
|
+
var __assign = undefined && undefined.__assign || function () {
|
|
10825
|
+
__assign = Object.assign || function (t) {
|
|
10826
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
10827
|
+
s = arguments[i];
|
|
10608
10828
|
|
|
10609
|
-
|
|
10829
|
+
for (var p in s) {
|
|
10830
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10831
|
+
}
|
|
10832
|
+
}
|
|
10833
|
+
|
|
10834
|
+
return t;
|
|
10835
|
+
};
|
|
10836
|
+
|
|
10837
|
+
return __assign.apply(this, arguments);
|
|
10838
|
+
};
|
|
10839
|
+
|
|
10840
|
+
|
|
10841
|
+
|
|
10842
|
+
|
|
10843
|
+
var CONNECTION_CHANGE = {
|
|
10844
|
+
KEEP_ALIVE_MISSED: {
|
|
10845
|
+
keepAliveState: 'unhealthy'
|
|
10846
|
+
},
|
|
10847
|
+
KEEP_ALIVE: {
|
|
10848
|
+
keepAliveState: 'healthy'
|
|
10849
|
+
},
|
|
10850
|
+
CONNECTION_ESTABLISHED: {
|
|
10851
|
+
connectionState: 'connected'
|
|
10852
|
+
},
|
|
10853
|
+
CONNECTION_FAILED: {
|
|
10854
|
+
intendedConnectionState: 'disconnected',
|
|
10855
|
+
connectionState: 'disconnected'
|
|
10856
|
+
},
|
|
10857
|
+
CLOSING_CONNECTION: {
|
|
10858
|
+
intendedConnectionState: 'disconnected'
|
|
10859
|
+
},
|
|
10860
|
+
OPENING_CONNECTION: {
|
|
10861
|
+
intendedConnectionState: 'connected',
|
|
10862
|
+
connectionState: 'connecting'
|
|
10863
|
+
},
|
|
10864
|
+
CLOSED: {
|
|
10865
|
+
connectionState: 'disconnected'
|
|
10866
|
+
},
|
|
10867
|
+
ONLINE: {
|
|
10868
|
+
networkState: 'connected'
|
|
10869
|
+
},
|
|
10870
|
+
OFFLINE: {
|
|
10871
|
+
networkState: 'disconnected'
|
|
10872
|
+
}
|
|
10873
|
+
};
|
|
10874
|
+
|
|
10875
|
+
var ConnectionStateMonitor =
|
|
10876
|
+
/** @class */
|
|
10877
|
+
function () {
|
|
10878
|
+
function ConnectionStateMonitor() {
|
|
10879
|
+
var _this = this;
|
|
10880
|
+
|
|
10881
|
+
this._networkMonitoringSubscription = undefined;
|
|
10882
|
+
this._linkedConnectionState = {
|
|
10883
|
+
networkState: 'connected',
|
|
10884
|
+
connectionState: 'disconnected',
|
|
10885
|
+
intendedConnectionState: 'disconnected',
|
|
10886
|
+
keepAliveState: 'healthy'
|
|
10887
|
+
};
|
|
10888
|
+
this._linkedConnectionStateObservable = new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (connectionStateObserver) {
|
|
10889
|
+
connectionStateObserver.next(_this._linkedConnectionState);
|
|
10890
|
+
_this._linkedConnectionStateObserver = connectionStateObserver;
|
|
10891
|
+
});
|
|
10892
|
+
}
|
|
10893
|
+
/**
|
|
10894
|
+
* Turn network state monitoring on if it isn't on already
|
|
10895
|
+
*/
|
|
10896
|
+
|
|
10897
|
+
|
|
10898
|
+
ConnectionStateMonitor.prototype.enableNetworkMonitoring = function () {
|
|
10899
|
+
var _this = this; // Maintain the network state based on the reachability monitor
|
|
10900
|
+
|
|
10901
|
+
|
|
10902
|
+
if (this._networkMonitoringSubscription === undefined) {
|
|
10903
|
+
this._networkMonitoringSubscription = Object(_ReachabilityMonitor__WEBPACK_IMPORTED_MODULE_2__["ReachabilityMonitor"])().subscribe(function (_a) {
|
|
10904
|
+
var online = _a.online;
|
|
10905
|
+
|
|
10906
|
+
_this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);
|
|
10907
|
+
});
|
|
10908
|
+
}
|
|
10909
|
+
};
|
|
10910
|
+
/**
|
|
10911
|
+
* Turn network state monitoring off if it isn't off already
|
|
10912
|
+
*/
|
|
10913
|
+
|
|
10914
|
+
|
|
10915
|
+
ConnectionStateMonitor.prototype.disableNetworkMonitoring = function () {
|
|
10916
|
+
var _a;
|
|
10917
|
+
|
|
10918
|
+
(_a = this._networkMonitoringSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
10919
|
+
this._networkMonitoringSubscription = undefined;
|
|
10920
|
+
};
|
|
10921
|
+
|
|
10922
|
+
Object.defineProperty(ConnectionStateMonitor.prototype, "connectionStateObservable", {
|
|
10923
|
+
/**
|
|
10924
|
+
* Get the observable that allows us to monitor the connection state
|
|
10925
|
+
*
|
|
10926
|
+
* @returns {Observable<ConnectionState>} - The observable that emits ConnectionState updates
|
|
10927
|
+
*/
|
|
10928
|
+
get: function get() {
|
|
10929
|
+
var _this = this;
|
|
10930
|
+
|
|
10931
|
+
var previous; // The linked state aggregates state changes to any of the network, connection,
|
|
10932
|
+
// intendedConnection and keepAliveHealth. Some states will change these independent
|
|
10933
|
+
// states without changing the overall connection state.
|
|
10934
|
+
// After translating from linked states to ConnectionState, then remove any duplicates
|
|
10935
|
+
|
|
10936
|
+
return this._linkedConnectionStateObservable.map(function (value) {
|
|
10937
|
+
return _this.connectionStatesTranslator(value);
|
|
10938
|
+
}).filter(function (current) {
|
|
10939
|
+
var toInclude = current !== previous;
|
|
10940
|
+
previous = current;
|
|
10941
|
+
return toInclude;
|
|
10942
|
+
});
|
|
10943
|
+
},
|
|
10944
|
+
enumerable: true,
|
|
10945
|
+
configurable: true
|
|
10946
|
+
});
|
|
10947
|
+
/*
|
|
10948
|
+
* Updates local connection state and emits the full state to the observer.
|
|
10949
|
+
*/
|
|
10950
|
+
|
|
10951
|
+
ConnectionStateMonitor.prototype.record = function (statusUpdates) {
|
|
10952
|
+
// Maintain the network monitor
|
|
10953
|
+
if (statusUpdates.intendedConnectionState === 'connected') {
|
|
10954
|
+
this.enableNetworkMonitoring();
|
|
10955
|
+
} else if (statusUpdates.intendedConnectionState === 'disconnected') {
|
|
10956
|
+
this.disableNetworkMonitoring();
|
|
10957
|
+
} // Maintain the socket state
|
|
10958
|
+
|
|
10959
|
+
|
|
10960
|
+
var newSocketStatus = __assign(__assign({}, this._linkedConnectionState), statusUpdates);
|
|
10961
|
+
|
|
10962
|
+
this._linkedConnectionState = __assign({}, newSocketStatus);
|
|
10963
|
+
|
|
10964
|
+
this._linkedConnectionStateObserver.next(this._linkedConnectionState);
|
|
10965
|
+
};
|
|
10966
|
+
/*
|
|
10967
|
+
* Translate the ConnectionState structure into a specific ConnectionState string literal union
|
|
10968
|
+
*/
|
|
10969
|
+
|
|
10970
|
+
|
|
10971
|
+
ConnectionStateMonitor.prototype.connectionStatesTranslator = function (_a) {
|
|
10972
|
+
var connectionState = _a.connectionState,
|
|
10973
|
+
networkState = _a.networkState,
|
|
10974
|
+
intendedConnectionState = _a.intendedConnectionState,
|
|
10975
|
+
keepAliveState = _a.keepAliveState;
|
|
10976
|
+
if (connectionState === 'connected' && networkState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingNetwork;
|
|
10977
|
+
if (connectionState === 'connected' && intendedConnectionState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingDisconnect;
|
|
10978
|
+
if (connectionState === 'disconnected' && intendedConnectionState === 'connected' && networkState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectionDisruptedPendingNetwork;
|
|
10979
|
+
if (connectionState === 'disconnected' && intendedConnectionState === 'connected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectionDisrupted;
|
|
10980
|
+
if (connectionState === 'connected' && keepAliveState === 'unhealthy') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].ConnectedPendingKeepAlive; // All remaining states directly correspond to the connection state
|
|
10981
|
+
|
|
10982
|
+
if (connectionState === 'connecting') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Connecting;
|
|
10983
|
+
if (connectionState === 'disconnected') return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Disconnected;
|
|
10984
|
+
return _types_PubSub__WEBPACK_IMPORTED_MODULE_1__["ConnectionState"].Connected;
|
|
10985
|
+
};
|
|
10986
|
+
|
|
10987
|
+
return ConnectionStateMonitor;
|
|
10988
|
+
}();
|
|
10989
|
+
|
|
10990
|
+
|
|
10991
|
+
|
|
10992
|
+
/***/ }),
|
|
10993
|
+
|
|
10994
|
+
/***/ "./lib-esm/utils/ReachabilityMonitor/index.js":
|
|
10995
|
+
/*!****************************************************!*\
|
|
10996
|
+
!*** ./lib-esm/utils/ReachabilityMonitor/index.js ***!
|
|
10997
|
+
\****************************************************/
|
|
10998
|
+
/*! exports provided: ReachabilityMonitor */
|
|
10999
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
11000
|
+
|
|
11001
|
+
"use strict";
|
|
11002
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11003
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReachabilityMonitor", function() { return ReachabilityMonitor; });
|
|
11004
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
|
|
11005
|
+
/* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__);
|
|
11006
|
+
|
|
11007
|
+
var ReachabilityMonitor = function ReachabilityMonitor() {
|
|
11008
|
+
return new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_0__["Reachability"]().networkMonitor();
|
|
11009
|
+
};
|
|
10610
11010
|
|
|
10611
11011
|
/***/ }),
|
|
10612
11012
|
|