1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 | // SPDX-License-Identifier: Apache-2.0
|
5 | exports.MAX_DELAY_MS = 5000;
|
6 | exports.NON_RETRYABLE_CODES = [400, 401, 403];
|
7 | exports.CONNECTION_STATE_CHANGE = 'ConnectionStateChange';
|
8 | var MESSAGE_TYPES;
|
9 | (function (MESSAGE_TYPES) {
|
10 | /**
|
11 | * Client -> Server message.
|
12 | * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication
|
13 | */
|
14 | MESSAGE_TYPES["GQL_CONNECTION_INIT"] = "connection_init";
|
15 | /**
|
16 | * Server -> Client message
|
17 | * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection
|
18 | */
|
19 | MESSAGE_TYPES["GQL_CONNECTION_ERROR"] = "connection_error";
|
20 | /**
|
21 | * Server -> Client message.
|
22 | * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message
|
23 | */
|
24 | MESSAGE_TYPES["GQL_CONNECTION_ACK"] = "connection_ack";
|
25 | /**
|
26 | * Client -> Server message.
|
27 | * This message type is for register subscriptions with AWS AppSync RealTime
|
28 | */
|
29 | MESSAGE_TYPES["GQL_START"] = "start";
|
30 | /**
|
31 | * Server -> Client message.
|
32 | * This message type is for the ack response from AWS AppSync RealTime for GQL_START message
|
33 | */
|
34 | MESSAGE_TYPES["GQL_START_ACK"] = "start_ack";
|
35 | /**
|
36 | * Server -> Client message.
|
37 | * This message type is for subscription message from AWS AppSync RealTime
|
38 | */
|
39 | MESSAGE_TYPES["GQL_DATA"] = "data";
|
40 | /**
|
41 | * Server -> Client message.
|
42 | * This message type helps the client to know is still receiving messages from AWS AppSync RealTime
|
43 | */
|
44 | MESSAGE_TYPES["GQL_CONNECTION_KEEP_ALIVE"] = "ka";
|
45 | /**
|
46 | * Client -> Server message.
|
47 | * This message type is for unregister subscriptions with AWS AppSync RealTime
|
48 | */
|
49 | MESSAGE_TYPES["GQL_STOP"] = "stop";
|
50 | /**
|
51 | * Server -> Client message.
|
52 | * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message
|
53 | */
|
54 | MESSAGE_TYPES["GQL_COMPLETE"] = "complete";
|
55 | /**
|
56 | * Server -> Client message.
|
57 | * This message type is for sending error messages from AWS AppSync RealTime to the client
|
58 | */
|
59 | MESSAGE_TYPES["GQL_ERROR"] = "error";
|
60 | })(MESSAGE_TYPES = exports.MESSAGE_TYPES || (exports.MESSAGE_TYPES = {}));
|
61 | var SUBSCRIPTION_STATUS;
|
62 | (function (SUBSCRIPTION_STATUS) {
|
63 | SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["PENDING"] = 0] = "PENDING";
|
64 | SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["CONNECTED"] = 1] = "CONNECTED";
|
65 | SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS["FAILED"] = 2] = "FAILED";
|
66 | })(SUBSCRIPTION_STATUS = exports.SUBSCRIPTION_STATUS || (exports.SUBSCRIPTION_STATUS = {}));
|
67 | var SOCKET_STATUS;
|
68 | (function (SOCKET_STATUS) {
|
69 | SOCKET_STATUS[SOCKET_STATUS["CLOSED"] = 0] = "CLOSED";
|
70 | SOCKET_STATUS[SOCKET_STATUS["READY"] = 1] = "READY";
|
71 | SOCKET_STATUS[SOCKET_STATUS["CONNECTING"] = 2] = "CONNECTING";
|
72 | })(SOCKET_STATUS = exports.SOCKET_STATUS || (exports.SOCKET_STATUS = {}));
|
73 | exports.AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
|
74 | ? Symbol.for('amplify_default')
|
75 | : '@@amplify_default');
|
76 | exports.AWS_APPSYNC_REALTIME_HEADERS = {
|
77 | accept: 'application/json, text/javascript',
|
78 | 'content-encoding': 'amz-1.0',
|
79 | 'content-type': 'application/json; charset=UTF-8',
|
80 | };
|
81 | /**
|
82 | * Time in milleseconds to wait for GQL_CONNECTION_INIT message
|
83 | */
|
84 | exports.CONNECTION_INIT_TIMEOUT = 15000;
|
85 | /**
|
86 | * Time in milleseconds to wait for GQL_START_ACK message
|
87 | */
|
88 | exports.START_ACK_TIMEOUT = 15000;
|
89 | /**
|
90 | * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
91 | */
|
92 | exports.DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
93 | /**
|
94 | * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message
|
95 | */
|
96 | exports.DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;
|
97 | /**
|
98 | * Default delay time in milleseconds between when reconnect is triggered vs when it is attempted
|
99 | */
|
100 | exports.RECONNECT_DELAY = 5 * 1000;
|
101 | /**
|
102 | * Default interval time in milleseconds between when reconnect is re-attempted
|
103 | */
|
104 | exports.RECONNECT_INTERVAL = 60 * 1000;
|
105 | //# sourceMappingURL=constants.js.map |
\ | No newline at end of file |