UNPKG

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