UNPKG

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