@aws-amplify/pubsub 4.4.10 → 4.5.0

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 (29) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/aws-amplify-pubsub.js +178 -141
  3. package/dist/aws-amplify-pubsub.js.map +1 -1
  4. package/dist/aws-amplify-pubsub.min.js +2 -2
  5. package/dist/aws-amplify-pubsub.min.js.map +1 -1
  6. package/lib/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
  7. package/lib/Providers/AWSAppSyncRealTimeProvider/index.js +8 -8
  8. package/lib/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  9. package/lib/Providers/MqttOverWSProvider.d.ts +1 -0
  10. package/lib/Providers/MqttOverWSProvider.js +23 -1
  11. package/lib/Providers/MqttOverWSProvider.js.map +1 -1
  12. package/lib/Providers/{AWSAppSyncRealTimeProvider/constants.d.ts → constants.d.ts} +0 -0
  13. package/lib/Providers/{AWSAppSyncRealTimeProvider/constants.js → constants.js} +0 -0
  14. package/lib/Providers/constants.js.map +1 -0
  15. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.d.ts +1 -1
  16. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js +8 -8
  17. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/index.js.map +1 -1
  18. package/lib-esm/Providers/MqttOverWSProvider.d.ts +1 -0
  19. package/lib-esm/Providers/MqttOverWSProvider.js +24 -2
  20. package/lib-esm/Providers/MqttOverWSProvider.js.map +1 -1
  21. package/lib-esm/Providers/{AWSAppSyncRealTimeProvider/constants.d.ts → constants.d.ts} +0 -0
  22. package/lib-esm/Providers/{AWSAppSyncRealTimeProvider/constants.js → constants.js} +0 -0
  23. package/lib-esm/Providers/constants.js.map +1 -0
  24. package/package.json +5 -5
  25. package/src/Providers/AWSAppSyncRealTimeProvider/index.ts +14 -14
  26. package/src/Providers/MqttOverWSProvider.ts +43 -2
  27. package/src/Providers/{AWSAppSyncRealTimeProvider/constants.ts → constants.ts} +0 -0
  28. package/lib/Providers/AWSAppSyncRealTimeProvider/constants.js.map +0 -1
  29. package/lib-esm/Providers/AWSAppSyncRealTimeProvider/constants.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.5.0](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.4.10...@aws-amplify/pubsub@4.5.0) (2022-08-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **pubsub:** Connection Ack verification bug ([#10200](https://github.com/aws-amplify/amplify-js/issues/10200)) ([d6cb7f9](https://github.com/aws-amplify/amplify-js/commit/d6cb7f95d68b05c9668bfd1f823b9db264f6291e))
12
+
13
+
14
+ ### Features
15
+
16
+ * PubSub Connection state tracking for MQTT and IoT providers ([#10136](https://github.com/aws-amplify/amplify-js/issues/10136)) ([f28918b](https://github.com/aws-amplify/amplify-js/commit/f28918b1ca1111f98c231c8ed6bccace9ad9e607))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [4.4.10](https://github.com/aws-amplify/amplify-js/compare/@aws-amplify/pubsub@4.4.9...@aws-amplify/pubsub@4.4.10) (2022-08-16)
7
23
 
8
24
 
@@ -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) {
@@ -8827,14 +8696,17 @@ function (_super) {
8827
8696
 
8828
8697
  _this.awsRealTimeSocket.send(JSON.stringify(gqlInit));
8829
8698
 
8830
- setTimeout(checkAckOk.bind(_this, ackOk_1), _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"]);
8831
- }
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);
8832
8702
 
8833
- function checkAckOk(ackOk) {
8834
- if (!ackOk) {
8835
- this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_11__["CONNECTION_CHANGE"].CONNECTION_FAILED);
8836
- rej(new Error("Connection timeout: ack from AWSRealTime was not received on " + _constants__WEBPACK_IMPORTED_MODULE_10__["CONNECTION_INIT_TIMEOUT"] + " ms"));
8837
- }
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"]);
8838
8710
  }
8839
8711
  });
8840
8712
  }()];
@@ -9401,6 +9273,9 @@ __webpack_require__.r(__webpack_exports__);
9401
9273
  /* harmony import */ var _PubSubProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./PubSubProvider */ "./lib-esm/Providers/PubSubProvider.js");
9402
9274
  /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
9403
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");
9278
+ /* harmony import */ var ___WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! .. */ "./lib-esm/index.js");
9404
9279
  function _typeof(obj) {
9405
9280
  "@babel/helpers - typeof";
9406
9281
 
@@ -9627,6 +9502,9 @@ var __rest = undefined && undefined.__rest || function (s, e) {
9627
9502
 
9628
9503
 
9629
9504
 
9505
+
9506
+
9507
+
9630
9508
  var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["ConsoleLogger"]('MqttOverWSProvider');
9631
9509
  function mqttTopicMatch(filter, topic) {
9632
9510
  var filterArray = filter.split('/');
@@ -9692,6 +9570,14 @@ function () {
9692
9570
  return ClientsQueue;
9693
9571
  }();
9694
9572
 
9573
+ var dispatchPubSubEvent = function dispatchPubSubEvent(event, data, message) {
9574
+ _aws_amplify_core__WEBPACK_IMPORTED_MODULE_4__["Hub"].dispatch('pubsub', {
9575
+ event: event,
9576
+ data: data,
9577
+ message: message
9578
+ }, 'PubSub', _constants__WEBPACK_IMPORTED_MODULE_6__["AMPLIFY_SYMBOL"]);
9579
+ };
9580
+
9695
9581
  var topicSymbol = typeof Symbol !== 'undefined' ? Symbol('topic') : '@@topic';
9696
9582
 
9697
9583
  var MqttOverWSProvider =
@@ -9709,8 +9595,17 @@ function (_super) {
9709
9595
  })) || this;
9710
9596
 
9711
9597
  _this._clientsQueue = new ClientsQueue();
9598
+ _this.connectionStateMonitor = new _utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["ConnectionStateMonitor"]();
9712
9599
  _this._topicObservers = new Map();
9713
- _this._clientIdObservers = new Map();
9600
+ _this._clientIdObservers = new Map(); // Monitor the connection health state and pass changes along to Hub
9601
+
9602
+ _this.connectionStateMonitor.connectionStateObservable.subscribe(function (connectionStateChange) {
9603
+ dispatchPubSubEvent(___WEBPACK_IMPORTED_MODULE_7__["CONNECTION_STATE_CHANGE"], {
9604
+ provider: _this,
9605
+ connectionState: connectionStateChange
9606
+ }, "Connection state is " + connectionStateChange);
9607
+ });
9608
+
9714
9609
  return _this;
9715
9610
  }
9716
9611
 
@@ -9807,6 +9702,7 @@ function (_super) {
9807
9702
  switch (_b.label) {
9808
9703
  case 0:
9809
9704
  logger.debug('Creating new MQTT client', clientId);
9705
+ this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].OPENING_CONNECTION);
9810
9706
  client = new paho_mqtt__WEBPACK_IMPORTED_MODULE_0__["Client"](url, clientId); // client.trace = (args) => logger.debug(clientId, JSON.stringify(args, null, 2));
9811
9707
 
9812
9708
  client.onMessageArrived = function (_a) {
@@ -9824,6 +9720,8 @@ function (_super) {
9824
9720
  clientId: clientId,
9825
9721
  errorCode: errorCode
9826
9722
  }, args));
9723
+
9724
+ _this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
9827
9725
  };
9828
9726
 
9829
9727
  return [4
@@ -9835,13 +9733,18 @@ function (_super) {
9835
9733
  onSuccess: function onSuccess() {
9836
9734
  return resolve(client);
9837
9735
  },
9838
- onFailure: reject
9736
+ onFailure: function onFailure() {
9737
+ reject();
9738
+
9739
+ _this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_FAILED);
9740
+ }
9839
9741
  });
9840
9742
  })];
9841
9743
 
9842
9744
  case 1:
9843
9745
  _b.sent();
9844
9746
 
9747
+ this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CONNECTION_ESTABLISHED);
9845
9748
  return [2
9846
9749
  /*return*/
9847
9750
  , client];
@@ -9893,6 +9796,7 @@ function (_super) {
9893
9796
 
9894
9797
  if (client && client.isConnected()) {
9895
9798
  client.disconnect();
9799
+ this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSED);
9896
9800
  }
9897
9801
 
9898
9802
  this.clientsQueue.remove(clientId);
@@ -10073,6 +9977,8 @@ function (_super) {
10073
9977
  (_a = _this._clientIdObservers.get(clientId)) === null || _a === void 0 ? void 0 : _a["delete"](observer); // No more observers per client => client not needed anymore
10074
9978
 
10075
9979
  if (((_b = _this._clientIdObservers.get(clientId)) === null || _b === void 0 ? void 0 : _b.size) === 0) {
9980
+ _this.connectionStateMonitor.record(_utils_ConnectionStateMonitor__WEBPACK_IMPORTED_MODULE_5__["CONNECTION_CHANGE"].CLOSING_CONNECTION);
9981
+
10076
9982
  _this.disconnect(clientId);
10077
9983
 
10078
9984
  _this._clientIdObservers["delete"](clientId);
@@ -10172,6 +10078,137 @@ function () {
10172
10078
 
10173
10079
 
10174
10080
 
10081
+ /***/ }),
10082
+
10083
+ /***/ "./lib-esm/Providers/constants.js":
10084
+ /*!****************************************!*\
10085
+ !*** ./lib-esm/Providers/constants.js ***!
10086
+ \****************************************/
10087
+ /*! 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 */
10088
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
10089
+
10090
+ "use strict";
10091
+ __webpack_require__.r(__webpack_exports__);
10092
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAX_DELAY_MS", function() { return MAX_DELAY_MS; });
10093
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NON_RETRYABLE_CODES", function() { return NON_RETRYABLE_CODES; });
10094
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGE_TYPES", function() { return MESSAGE_TYPES; });
10095
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SUBSCRIPTION_STATUS", function() { return SUBSCRIPTION_STATUS; });
10096
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SOCKET_STATUS", function() { return SOCKET_STATUS; });
10097
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMPLIFY_SYMBOL", function() { return AMPLIFY_SYMBOL; });
10098
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_APPSYNC_REALTIME_HEADERS", function() { return AWS_APPSYNC_REALTIME_HEADERS; });
10099
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONNECTION_INIT_TIMEOUT", function() { return CONNECTION_INIT_TIMEOUT; });
10100
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "START_ACK_TIMEOUT", function() { return START_ACK_TIMEOUT; });
10101
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_TIMEOUT; });
10102
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT", function() { return DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT; });
10103
+ var MAX_DELAY_MS = 5000;
10104
+ var NON_RETRYABLE_CODES = [400, 401, 403];
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
+
10175
10212
  /***/ }),
10176
10213
 
10177
10214
  /***/ "./lib-esm/Providers/index.js":