@aws-amplify/pubsub 4.4.10 → 4.4.11-unstable.4

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 (28) hide show
  1. package/dist/aws-amplify-pubsub.js +168 -134
  2. package/dist/aws-amplify-pubsub.js.map +1 -1
  3. package/dist/aws-amplify-pubsub.min.js +2 -2
  4. package/dist/aws-amplify-pubsub.min.js.map +1 -1
  5. package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
  6. package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +1 -1
  7. package/lib/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  8. package/lib/Providers/MqttOverWSProvider.d.ts +1 -0
  9. package/lib/Providers/MqttOverWSProvider.js +23 -1
  10. package/lib/Providers/MqttOverWSProvider.js.map +1 -1
  11. package/lib/Providers/{AWSAppSyncRealTimeProvider/constants.d.ts → constants.d.ts} +0 -0
  12. package/lib/Providers/{AWSAppSyncRealTimeProvider/constants.js → constants.js} +0 -0
  13. package/lib/Providers/constants.js.map +1 -0
  14. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
  15. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +1 -1
  16. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  17. package/lib-esm/Providers/MqttOverWSProvider.d.ts +1 -0
  18. package/lib-esm/Providers/MqttOverWSProvider.js +24 -2
  19. package/lib-esm/Providers/MqttOverWSProvider.js.map +1 -1
  20. package/lib-esm/Providers/{AWSAppSyncRealTimeProvider/constants.d.ts → constants.d.ts} +0 -0
  21. package/lib-esm/Providers/{AWSAppSyncRealTimeProvider/constants.js → constants.js} +0 -0
  22. package/lib-esm/Providers/constants.js.map +1 -0
  23. package/package.json +5 -5
  24. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +1 -1
  25. package/src/Providers/MqttOverWSProvider.ts +43 -2
  26. package/src/Providers/{AWSAppSyncRealTimeProvider/constants.ts → constants.ts} +0 -0
  27. package/lib/Providers/AWSAppSyncRealTimeProvider/constants.js.map +0 -1
  28. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js.map +0 -1
@@ -7612,137 +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, DEFAULT_KEEP_ALIVE_ALERT_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
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT; });
7637
- var MAX_DELAY_MS = 5000;
7638
- var NON_RETRYABLE_CODES = [400, 401, 403];
7639
- var MESSAGE_TYPES;
7640
-
7641
- (function (MESSAGE_TYPES) {
7642
- /**
7643
- * Client -> Server message.
7644
- * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
7645
- */
7646
- MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
7647
- /**
7648
- * Server -> Client message
7649
- * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
7650
- */
7651
-
7652
- MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
7653
- /**
7654
- * Server -> Client message.
7655
- * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
7656
- */
7657
-
7658
- MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
7659
- /**
7660
- * Client -> Server message.
7661
- * This message type is for register subscriptions with AWS AppSync RealTime
7662
- */
7663
-
7664
- MESSAGE_TYPES["GQL_START"] = "start";
7665
- /**
7666
- * Server -> Client message.
7667
- * This message type is for the ack response from AWS AppSync RealTime for GQL_START message
7668
- */
7669
-
7670
- MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
7671
- /**
7672
- * Server -> Client message.
7673
- * This message type is for subscription message from AWS AppSync RealTime
7674
- */
7675
-
7676
- MESSAGE_TYPES["GQL_DATA"] = "data";
7677
- /**
7678
- * Server -> Client message.
7679
- * This message type helps the client to know is still receiving messages from AWS AppSync RealTime
7680
- */
7681
-
7682
- MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
7683
- /**
7684
- * Client -> Server message.
7685
- * This message type is for unregister subscriptions with AWS AppSync RealTime
7686
- */
7687
-
7688
- MESSAGE_TYPES["GQL_STOP"] = "stop";
7689
- /**
7690
- * Server -> Client message.
7691
- * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
7692
- */
7693
-
7694
- MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
7695
- /**
7696
- * Server -> Client message.
7697
- * This message type is for sending error messages from AWS AppSync RealTime to the client
7698
- */
7699
-
7700
- MESSAGE_TYPES["GQL_ERROR"] = "error";
7701
- })(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
7702
-
7703
- var SUBSCRIPTION_STATUS;
7704
-
7705
- (function (SUBSCRIPTION_STATUS) {
7706
- SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
7707
- SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
7708
- SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
7709
- })(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
7710
-
7711
- var SOCKET_STATUS;
7712
-
7713
- (function (SOCKET_STATUS) {
7714
- SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
7715
- SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
7716
- SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
7717
- })(SOCKET_STATUS || (SOCKET_STATUS = {}));
7718
-
7719
- var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
7720
- var AWS_APPSYNC_REALTIME_HEADERS = {
7721
- accept: 'application/json, text/javascript',
7722
- 'content-encoding': 'amz-1.0',
7723
- 'content-type': 'application/json; charset=UTF-8'
7724
- };
7725
- /**
7726
- * Time in milleseconds to wait for GQL_CONNECTION_INIT message
7727
- */
7728
-
7729
- var CONNECTION_INIT_TIMEOUT = 15000;
7730
- /**
7731
- * Time in milleseconds to wait for GQL_START_ACK message
7732
- */
7733
-
7734
- var START_ACK_TIMEOUT = 15000;
7735
- /**
7736
- * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
7737
- */
7738
-
7739
- var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
7740
- /**
7741
- * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
7742
- */
7743
-
7744
- var DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;
7745
-
7746
7615
  /***/ }),
7747
7616
 
7748
7617
  /***/ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js":
@@ -7772,7 +7641,7 @@ __webpack_require__.r(__webpack_exports__);
7772
7641
  /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_7__);
7773
7642
  /* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PubSubProvider */ "./lib-esm/Providers/PubSubProvider.js");
7774
7643
  /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../index */ "./lib-esm/index.js");
7775
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./constants */ "./lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js");
7644
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../constants */ "./lib-esm/Providers/constants.js");
7776
7645
  /* harmony import */ var _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../utils/ConnectionStateMonitor */ "./lib-esm/utils/ConnectionStateMonitor.js");
7777
7646
  var __extends = undefined && undefined.__extends || function () {
7778
7647
  var _extendStatics = function extendStatics(d, b) {
@@ -9401,6 +9270,9 @@ __webpack_require__.r(__webpack_exports__);
9401
9270
  /* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PubSubProvider */ "./lib-esm/Providers/PubSubProvider.js");
9402
9271
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
9403
9272
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__);
9273
+ /* harmony import */ var _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/ConnectionStateMonitor */ "./lib-esm/utils/ConnectionStateMonitor.js");
9274
+ /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ "./lib-esm/Providers/constants.js");
9275
+ /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! .. */ "./lib-esm/index.js");
9404
9276
  function _typeof(obj) {
9405
9277
  "@babel/helpers - typeof";
9406
9278
 
@@ -9627,6 +9499,9 @@ var __rest = undefined && undefined.__rest || function (s, e) {
9627
9499
 
9628
9500
 
9629
9501
 
9502
+
9503
+
9504
+
9630
9505
  var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["ConsoleLogger"]('MqttOverWSProvider');
9631
9506
  function mqttTopicMatch(filter, topic) {
9632
9507
  var filterArray = filter.split('/');
@@ -9692,6 +9567,14 @@ function () {
9692
9567
  return ClientsQueue;
9693
9568
  }();
9694
9569
 
9570
+ var dispatchPubSubEvent = function dispatchPubSubEvent(event, data, message) {
9571
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["Hub"].dispatch('pubsub', {
9572
+ event: event,
9573
+ data: data,
9574
+ message: message
9575
+ }, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_6__["AMPLIFY_SYMBOL"]);
9576
+ };
9577
+
9695
9578
  var topicSymbol = typeof Symbol !== 'undefined' ? Symbol('topic') : '@@topic';
9696
9579
 
9697
9580
  var MqttOverWSProvider =
@@ -9709,8 +9592,17 @@ function (_super) {
9709
9592
  })) || this;
9710
9593
 
9711
9594
  _this._clientsQueue = new ClientsQueue();
9595
+ _this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["ConnectionStateMonitor"]();
9712
9596
  _this._topicObservers = new Map();
9713
- _this._clientIdObservers = new Map();
9597
+ _this._clientIdObservers = new Map(); // Monitor the connection health state and pass changes along to Hub
9598
+
9599
+ _this.connectionStateMonitor.connectionStateObservable.subscribe(function (connectionStateChange) {
9600
+ dispatchPubSubEvent(___WEBPACK_IMPORTED_MODULE_7__["CONNECTION_STATE_CHANGE"], {
9601
+ provider: _this,
9602
+ connectionState: connectionStateChange
9603
+ }, "Connection state is " + connectionStateChange);
9604
+ });
9605
+
9714
9606
  return _this;
9715
9607
  }
9716
9608
 
@@ -9807,6 +9699,7 @@ function (_super) {
9807
9699
  switch (_b.label) {
9808
9700
  case 0:
9809
9701
  logger.debug('Creating new MQTT client', clientId);
9702
+ this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].OPENING_CONNECTION);
9810
9703
  client = new paho_mqtt__WEBPACK_IMPORTED_MODULE_0__["Client"](url, clientId); // client.trace = (args) => logger.debug(clientId, JSON.stringify(args, null, 2));
9811
9704
 
9812
9705
  client.onMessageArrived = function (_a) {
@@ -9824,6 +9717,8 @@ function (_super) {
9824
9717
  clientId: clientId,
9825
9718
  errorCode: errorCode
9826
9719
  }, args));
9720
+
9721
+ _this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
9827
9722
  };
9828
9723
 
9829
9724
  return [4
@@ -9835,13 +9730,18 @@ function (_super) {
9835
9730
  onSuccess: function onSuccess() {
9836
9731
  return resolve(client);
9837
9732
  },
9838
- onFailure: reject
9733
+ onFailure: function onFailure() {
9734
+ reject();
9735
+
9736
+ _this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_FAILED);
9737
+ }
9839
9738
  });
9840
9739
  })];
9841
9740
 
9842
9741
  case 1:
9843
9742
  _b.sent();
9844
9743
 
9744
+ this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
9845
9745
  return [2
9846
9746
  /*return*/
9847
9747
  , client];
@@ -9893,6 +9793,7 @@ function (_super) {
9893
9793
 
9894
9794
  if (client && client.isConnected()) {
9895
9795
  client.disconnect();
9796
+ this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
9896
9797
  }
9897
9798
 
9898
9799
  this.clientsQueue.remove(clientId);
@@ -10073,6 +9974,8 @@ function (_super) {
10073
9974
  (_a = _this._clientIdObservers.get(clientId)) === null || _a === void 0 ? void 0 : _a["delete"](observer); // No more observers per client => client not needed anymore
10074
9975
 
10075
9976
  if (((_b = _this._clientIdObservers.get(clientId)) === null || _b === void 0 ? void 0 : _b.size) === 0) {
9977
+ _this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
9978
+
10076
9979
  _this.disconnect(clientId);
10077
9980
 
10078
9981
  _this._clientIdObservers["delete"](clientId);
@@ -10172,6 +10075,137 @@ function () {
10172
10075
 
10173
10076
 
10174
10077
 
10078
+ /***/ }),
10079
+
10080
+ /***/ "./lib-esm/Providers/constants.js":
10081
+ /*!****************************************!*\
10082
+ !*** ./lib-esm/Providers/constants.js ***!
10083
+ \****************************************/
10084
+ /*! 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, DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT */
10085
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
10086
+
10087
+ "use strict";
10088
+ __webpack_require__.r(__webpack_exports__);
10089
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_DELAY_MS", function() { return MAX_DELAY_MS; });
10090
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NON_RETRYABLE_CODES", function() { return NON_RETRYABLE_CODES; });
10091
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGE_TYPES", function() { return MESSAGE_TYPES; });
10092
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SUBSCRIPTION_STATUS", function() { return SUBSCRIPTION_STATUS; });
10093
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOCKET_STATUS", function() { return SOCKET_STATUS; });
10094
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMPLIFY_SYMBOL", function() { return AMPLIFY_SYMBOL; });
10095
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_APPSYNC_REALTIME_HEADERS", function() { return AWS_APPSYNC_REALTIME_HEADERS; });
10096
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_INIT_TIMEOUT", function() { return CONNECTION_INIT_TIMEOUT; });
10097
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "START_ACK_TIMEOUT", function() { return START_ACK_TIMEOUT; });
10098
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_TIMEOUT; });
10099
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT; });
10100
+ var MAX_DELAY_MS = 5000;
10101
+ var NON_RETRYABLE_CODES = [400, 401, 403];
10102
+ var MESSAGE_TYPES;
10103
+
10104
+ (function (MESSAGE_TYPES) {
10105
+ /**
10106
+ * Client -> Server message.
10107
+ * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
10108
+ */
10109
+ MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
10110
+ /**
10111
+ * Server -> Client message
10112
+ * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
10113
+ */
10114
+
10115
+ MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
10116
+ /**
10117
+ * Server -> Client message.
10118
+ * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
10119
+ */
10120
+
10121
+ MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
10122
+ /**
10123
+ * Client -> Server message.
10124
+ * This message type is for register subscriptions with AWS AppSync RealTime
10125
+ */
10126
+
10127
+ MESSAGE_TYPES["GQL_START"] = "start";
10128
+ /**
10129
+ * Server -> Client message.
10130
+ * This message type is for the ack response from AWS AppSync RealTime for GQL_START message
10131
+ */
10132
+
10133
+ MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
10134
+ /**
10135
+ * Server -> Client message.
10136
+ * This message type is for subscription message from AWS AppSync RealTime
10137
+ */
10138
+
10139
+ MESSAGE_TYPES["GQL_DATA"] = "data";
10140
+ /**
10141
+ * Server -> Client message.
10142
+ * This message type helps the client to know is still receiving messages from AWS AppSync RealTime
10143
+ */
10144
+
10145
+ MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
10146
+ /**
10147
+ * Client -> Server message.
10148
+ * This message type is for unregister subscriptions with AWS AppSync RealTime
10149
+ */
10150
+
10151
+ MESSAGE_TYPES["GQL_STOP"] = "stop";
10152
+ /**
10153
+ * Server -> Client message.
10154
+ * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
10155
+ */
10156
+
10157
+ MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
10158
+ /**
10159
+ * Server -> Client message.
10160
+ * This message type is for sending error messages from AWS AppSync RealTime to the client
10161
+ */
10162
+
10163
+ MESSAGE_TYPES["GQL_ERROR"] = "error";
10164
+ })(MESSAGE_TYPES || (MESSAGE_TYPES = {}));
10165
+
10166
+ var SUBSCRIPTION_STATUS;
10167
+
10168
+ (function (SUBSCRIPTION_STATUS) {
10169
+ SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
10170
+ SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
10171
+ SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
10172
+ })(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));
10173
+
10174
+ var SOCKET_STATUS;
10175
+
10176
+ (function (SOCKET_STATUS) {
10177
+ SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
10178
+ SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
10179
+ SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
10180
+ })(SOCKET_STATUS || (SOCKET_STATUS = {}));
10181
+
10182
+ var AMPLIFY_SYMBOL = typeof Symbol !== 'undefined' && typeof Symbol["for"] === 'function' ? Symbol["for"]('amplify_default') : '@@amplify_default';
10183
+ var AWS_APPSYNC_REALTIME_HEADERS = {
10184
+ accept: 'application/json, text/javascript',
10185
+ 'content-encoding': 'amz-1.0',
10186
+ 'content-type': 'application/json; charset=UTF-8'
10187
+ };
10188
+ /**
10189
+ * Time in milleseconds to wait for GQL_CONNECTION_INIT message
10190
+ */
10191
+
10192
+ var CONNECTION_INIT_TIMEOUT = 15000;
10193
+ /**
10194
+ * Time in milleseconds to wait for GQL_START_ACK message
10195
+ */
10196
+
10197
+ var START_ACK_TIMEOUT = 15000;
10198
+ /**
10199
+ * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
10200
+ */
10201
+
10202
+ var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
10203
+ /**
10204
+ * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
10205
+ */
10206
+
10207
+ var DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;
10208
+
10175
10209
  /***/ }),
10176
10210
 
10177
10211
  /***/ "./lib-esm/Providers/index.js":