aws-appsync-subscription-link 3.0.10 → 3.0.11
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.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
<a name="3.0.11"></a>
|
|
7
|
+
## [3.0.11](https://github.com/awslabs/aws-mobile-appsync-sdk-js/compare/aws-appsync-subscription-link@3.0.10...aws-appsync-subscription-link@3.0.11) (2022-05-02)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package aws-appsync-subscription-link
|
|
13
|
+
|
|
6
14
|
<a name="3.0.10"></a>
|
|
7
15
|
## [3.0.10](https://github.com/awslabs/aws-mobile-appsync-sdk-js/compare/aws-appsync-subscription-link@3.0.9...aws-appsync-subscription-link@3.0.10) (2022-03-04)
|
|
8
16
|
|
|
@@ -6,7 +6,8 @@ import { AppSyncRealTimeSubscriptionHandshakeLink } from '../../src/realtime-sub
|
|
|
6
6
|
const query = gql`subscription { someSubscription { aField } }`
|
|
7
7
|
|
|
8
8
|
class myWebSocket implements WebSocket {
|
|
9
|
-
binaryType: BinaryType;
|
|
9
|
+
binaryType: BinaryType;
|
|
10
|
+
bufferedAmount: number;
|
|
10
11
|
extensions: string;
|
|
11
12
|
onclose: (this: WebSocket, ev: CloseEvent) => any;
|
|
12
13
|
onerror: (this: WebSocket, ev: Event) => any;
|
|
@@ -49,8 +50,22 @@ describe("RealTime subscription link", () => {
|
|
|
49
50
|
type: AUTH_TYPE.API_KEY,
|
|
50
51
|
apiKey: 'xxxxx'
|
|
51
52
|
},
|
|
52
|
-
region: 'us-
|
|
53
|
-
url: 'https://
|
|
53
|
+
region: 'us-west-2',
|
|
54
|
+
url: 'https://firsttesturl12345678901234.appsync-api.us-west-2.amazonaws.com/graphql'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
expect(link).toBeInstanceOf(AppSyncRealTimeSubscriptionHandshakeLink);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("Can instantiate link with custom domain", () => {
|
|
61
|
+
expect.assertions(1);
|
|
62
|
+
const link = new AppSyncRealTimeSubscriptionHandshakeLink({
|
|
63
|
+
auth: {
|
|
64
|
+
type: AUTH_TYPE.API_KEY,
|
|
65
|
+
apiKey: 'xxxxx'
|
|
66
|
+
},
|
|
67
|
+
region: 'us-west-2',
|
|
68
|
+
url: 'https://test1.testcustomdomain.com/graphql'
|
|
54
69
|
});
|
|
55
70
|
|
|
56
71
|
expect(link).toBeInstanceOf(AppSyncRealTimeSubscriptionHandshakeLink);
|
|
@@ -62,7 +77,7 @@ describe("RealTime subscription link", () => {
|
|
|
62
77
|
return "2019-11-13T18:47:04.733Z";
|
|
63
78
|
}));
|
|
64
79
|
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
65
|
-
expect(url).toBe('wss://
|
|
80
|
+
expect(url).toBe('wss://apikeytesturl1234567890123.appsync-realtime-api.us-west-2.amazonaws.com/graphql?header=eyJob3N0IjoiYXBpa2V5dGVzdHVybDEyMzQ1Njc4OTAxMjMuYXBwc3luYy1hcGkudXMtd2VzdC0yLmFtYXpvbmF3cy5jb20iLCJ4LWFtei1kYXRlIjoiMjAxOTExMTNUMTg0NzA0WiIsIngtYXBpLWtleSI6Inh4eHh4In0=&payload=e30=');
|
|
66
81
|
expect(protocol).toBe('graphql-ws');
|
|
67
82
|
done();
|
|
68
83
|
return new myWebSocket();
|
|
@@ -72,13 +87,50 @@ describe("RealTime subscription link", () => {
|
|
|
72
87
|
type: AUTH_TYPE.API_KEY,
|
|
73
88
|
apiKey: 'xxxxx'
|
|
74
89
|
},
|
|
75
|
-
region: 'us-
|
|
76
|
-
url: 'https://
|
|
90
|
+
region: 'us-west-2',
|
|
91
|
+
url: 'https://apikeytesturl1234567890123.appsync-api.us-west-2.amazonaws.com/graphql'
|
|
77
92
|
});
|
|
78
93
|
|
|
79
94
|
execute(link, { query }).subscribe({
|
|
80
95
|
error: (err) => {
|
|
81
|
-
console.log(
|
|
96
|
+
console.log(JSON.stringify(err));
|
|
97
|
+
fail;
|
|
98
|
+
},
|
|
99
|
+
next: (data) => {
|
|
100
|
+
console.log({ data });
|
|
101
|
+
done();
|
|
102
|
+
},
|
|
103
|
+
complete: () => {
|
|
104
|
+
console.log('done with this');
|
|
105
|
+
done();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test("Initialize WebSocket correctly for API KEY with custom domain", (done) => {
|
|
112
|
+
expect.assertions(2);
|
|
113
|
+
jest.spyOn(Date.prototype, 'toISOString').mockImplementation(jest.fn(() => {
|
|
114
|
+
return "2019-11-13T18:47:04.733Z";
|
|
115
|
+
}));
|
|
116
|
+
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
117
|
+
expect(url).toBe('wss://apikeytest.testcustomdomain.com/graphql/realtime?header=eyJob3N0IjoiYXBpa2V5dGVzdC50ZXN0Y3VzdG9tZG9tYWluLmNvbSIsIngtYW16LWRhdGUiOiIyMDE5MTExM1QxODQ3MDRaIiwieC1hcGkta2V5IjoieHh4eHgifQ==&payload=e30=');
|
|
118
|
+
expect(protocol).toBe('graphql-ws');
|
|
119
|
+
done();
|
|
120
|
+
return new myWebSocket();
|
|
121
|
+
});
|
|
122
|
+
const link = new AppSyncRealTimeSubscriptionHandshakeLink({
|
|
123
|
+
auth: {
|
|
124
|
+
type: AUTH_TYPE.API_KEY,
|
|
125
|
+
apiKey: 'xxxxx'
|
|
126
|
+
},
|
|
127
|
+
region: 'us-west-2',
|
|
128
|
+
url: 'https://apikeytest.testcustomdomain.com/graphql'
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
execute(link, { query }).subscribe({
|
|
132
|
+
error: (err) => {
|
|
133
|
+
console.log(JSON.stringify(err));
|
|
82
134
|
fail;
|
|
83
135
|
},
|
|
84
136
|
next: (data) => {
|
|
@@ -99,7 +151,7 @@ describe("RealTime subscription link", () => {
|
|
|
99
151
|
return "2019-11-13T18:47:04.733Z";
|
|
100
152
|
}));
|
|
101
153
|
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
102
|
-
expect(url).toBe('wss://
|
|
154
|
+
expect(url).toBe('wss://cognitouserpooltesturl1234.appsync-realtime-api.us-west-2.amazonaws.com/graphql?header=eyJBdXRob3JpemF0aW9uIjoidG9rZW4iLCJob3N0IjoiY29nbml0b3VzZXJwb29sdGVzdHVybDEyMzQuYXBwc3luYy1hcGkudXMtd2VzdC0yLmFtYXpvbmF3cy5jb20ifQ==&payload=e30=');
|
|
103
155
|
expect(protocol).toBe('graphql-ws');
|
|
104
156
|
done();
|
|
105
157
|
return new myWebSocket();
|
|
@@ -109,13 +161,50 @@ describe("RealTime subscription link", () => {
|
|
|
109
161
|
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
|
|
110
162
|
jwtToken: 'token'
|
|
111
163
|
},
|
|
112
|
-
region: 'us-
|
|
113
|
-
url: 'https://
|
|
164
|
+
region: 'us-west-2',
|
|
165
|
+
url: 'https://cognitouserpooltesturl1234.appsync-api.us-west-2.amazonaws.com/graphql'
|
|
114
166
|
});
|
|
115
167
|
|
|
116
168
|
execute(link, { query }).subscribe({
|
|
117
169
|
error: (err) => {
|
|
118
|
-
console.log(
|
|
170
|
+
console.log(JSON.stringify(err));
|
|
171
|
+
fail;
|
|
172
|
+
},
|
|
173
|
+
next: (data) => {
|
|
174
|
+
console.log({ data });
|
|
175
|
+
done();
|
|
176
|
+
},
|
|
177
|
+
complete: () => {
|
|
178
|
+
console.log('done with this');
|
|
179
|
+
done();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test("Initialize WebSocket correctly for COGNITO USER POOLS with custom domain", (done) => {
|
|
186
|
+
expect.assertions(2);
|
|
187
|
+
jest.spyOn(Date.prototype, 'toISOString').mockImplementation(jest.fn(() => {
|
|
188
|
+
return "2019-11-13T18:47:04.733Z";
|
|
189
|
+
}));
|
|
190
|
+
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
191
|
+
expect(url).toBe('wss://cognitouserpools.testcustomdomain.com/graphql/realtime?header=eyJBdXRob3JpemF0aW9uIjoidG9rZW4iLCJob3N0IjoiY29nbml0b3VzZXJwb29scy50ZXN0Y3VzdG9tZG9tYWluLmNvbSJ9&payload=e30=');
|
|
192
|
+
expect(protocol).toBe('graphql-ws');
|
|
193
|
+
done();
|
|
194
|
+
return new myWebSocket();
|
|
195
|
+
});
|
|
196
|
+
const link = new AppSyncRealTimeSubscriptionHandshakeLink({
|
|
197
|
+
auth: {
|
|
198
|
+
type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
|
|
199
|
+
jwtToken: 'token'
|
|
200
|
+
},
|
|
201
|
+
region: 'us-west-2',
|
|
202
|
+
url: 'https://cognitouserpools.testcustomdomain.com/graphql'
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
execute(link, { query }).subscribe({
|
|
206
|
+
error: (err) => {
|
|
207
|
+
console.log(JSON.stringify(err));
|
|
119
208
|
fail;
|
|
120
209
|
},
|
|
121
210
|
next: (data) => {
|
|
@@ -136,7 +225,44 @@ describe("RealTime subscription link", () => {
|
|
|
136
225
|
return "2019-11-13T18:47:04.733Z";
|
|
137
226
|
}));
|
|
138
227
|
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
139
|
-
expect(url).toBe('wss://
|
|
228
|
+
expect(url).toBe('wss://openidconnecttesturl123456.appsync-realtime-api.us-west-2.amazonaws.com/graphql?header=eyJBdXRob3JpemF0aW9uIjoidG9rZW4iLCJob3N0Ijoib3BlbmlkY29ubmVjdHRlc3R1cmwxMjM0NTYuYXBwc3luYy1hcGkudXMtd2VzdC0yLmFtYXpvbmF3cy5jb20ifQ==&payload=e30=');
|
|
229
|
+
expect(protocol).toBe('graphql-ws');
|
|
230
|
+
done();
|
|
231
|
+
return new myWebSocket();
|
|
232
|
+
});
|
|
233
|
+
const link = new AppSyncRealTimeSubscriptionHandshakeLink({
|
|
234
|
+
auth: {
|
|
235
|
+
type: AUTH_TYPE.OPENID_CONNECT,
|
|
236
|
+
jwtToken: 'token'
|
|
237
|
+
},
|
|
238
|
+
region: 'us-west-2',
|
|
239
|
+
url: 'https://openidconnecttesturl123456.appsync-api.us-west-2.amazonaws.com/graphql'
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
execute(link, { query }).subscribe({
|
|
243
|
+
error: (err) => {
|
|
244
|
+
console.log(JSON.stringify(err));
|
|
245
|
+
fail;
|
|
246
|
+
},
|
|
247
|
+
next: (data) => {
|
|
248
|
+
console.log({ data });
|
|
249
|
+
done();
|
|
250
|
+
},
|
|
251
|
+
complete: () => {
|
|
252
|
+
console.log('done with this');
|
|
253
|
+
done();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
test("Initialize WebSocket correctly for OPENID_CONNECT with custom domain", (done) => {
|
|
260
|
+
expect.assertions(2);
|
|
261
|
+
jest.spyOn(Date.prototype, 'toISOString').mockImplementation(jest.fn(() => {
|
|
262
|
+
return "2019-11-13T18:47:04.733Z";
|
|
263
|
+
}));
|
|
264
|
+
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
265
|
+
expect(url).toBe('wss://openidconnecttesturl.testcustomdomain.com/graphql/realtime?header=eyJBdXRob3JpemF0aW9uIjoidG9rZW4iLCJob3N0Ijoib3BlbmlkY29ubmVjdHRlc3R1cmwudGVzdGN1c3RvbWRvbWFpbi5jb20ifQ==&payload=e30=');
|
|
140
266
|
expect(protocol).toBe('graphql-ws');
|
|
141
267
|
done();
|
|
142
268
|
return new myWebSocket();
|
|
@@ -146,13 +272,13 @@ describe("RealTime subscription link", () => {
|
|
|
146
272
|
type: AUTH_TYPE.OPENID_CONNECT,
|
|
147
273
|
jwtToken: 'token'
|
|
148
274
|
},
|
|
149
|
-
region: 'us-
|
|
150
|
-
url: 'https://
|
|
275
|
+
region: 'us-west-2',
|
|
276
|
+
url: 'https://openidconnecttesturl.testcustomdomain.com/graphql'
|
|
151
277
|
});
|
|
152
278
|
|
|
153
279
|
execute(link, { query }).subscribe({
|
|
154
280
|
error: (err) => {
|
|
155
|
-
console.log(
|
|
281
|
+
console.log(JSON.stringify(err));
|
|
156
282
|
fail;
|
|
157
283
|
},
|
|
158
284
|
next: (data) => {
|
|
@@ -173,7 +299,41 @@ describe("RealTime subscription link", () => {
|
|
|
173
299
|
return "2019-11-13T18:47:04.733Z";
|
|
174
300
|
}));
|
|
175
301
|
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
176
|
-
expect(url).toBe('wss://
|
|
302
|
+
expect(url).toBe('wss://awslambdatesturl1234567890.appsync-realtime-api.us-west-2.amazonaws.com/graphql?header=eyJBdXRob3JpemF0aW9uIjoidG9rZW4iLCJob3N0IjoiYXdzbGFtYmRhdGVzdHVybDEyMzQ1Njc4OTAuYXBwc3luYy1hcGkudXMtd2VzdC0yLmFtYXpvbmF3cy5jb20ifQ==&payload=e30=');
|
|
303
|
+
expect(protocol).toBe('graphql-ws');
|
|
304
|
+
done();
|
|
305
|
+
return new myWebSocket();
|
|
306
|
+
});
|
|
307
|
+
const link = new AppSyncRealTimeSubscriptionHandshakeLink({
|
|
308
|
+
auth: {
|
|
309
|
+
type: AUTH_TYPE.AWS_LAMBDA,
|
|
310
|
+
token: 'token'
|
|
311
|
+
},
|
|
312
|
+
region: 'us-west-2',
|
|
313
|
+
url: 'https://awslambdatesturl1234567890.appsync-api.us-west-2.amazonaws.com/graphql'
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
execute(link, { query }).subscribe({
|
|
317
|
+
error: (err) => {
|
|
318
|
+
fail;
|
|
319
|
+
},
|
|
320
|
+
next: (data) => {
|
|
321
|
+
done();
|
|
322
|
+
},
|
|
323
|
+
complete: () => {
|
|
324
|
+
done();
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
});
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
test('Initialize WebSocket correctly for AWS_LAMBDA with custom domain', (done) => {
|
|
331
|
+
expect.assertions(2);
|
|
332
|
+
jest.spyOn(Date.prototype, 'toISOString').mockImplementation(jest.fn(() => {
|
|
333
|
+
return "2019-11-13T18:47:04.733Z";
|
|
334
|
+
}));
|
|
335
|
+
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = jest.fn((url, protocol) => {
|
|
336
|
+
expect(url).toBe('wss://awslambdatesturl.testcustomdomain.com/graphql/realtime?header=eyJBdXRob3JpemF0aW9uIjoidG9rZW4iLCJob3N0IjoiYXdzbGFtYmRhdGVzdHVybC50ZXN0Y3VzdG9tZG9tYWluLmNvbSJ9&payload=e30=');
|
|
177
337
|
expect(protocol).toBe('graphql-ws');
|
|
178
338
|
done();
|
|
179
339
|
return new myWebSocket();
|
|
@@ -183,8 +343,8 @@ describe("RealTime subscription link", () => {
|
|
|
183
343
|
type: AUTH_TYPE.AWS_LAMBDA,
|
|
184
344
|
token: 'token'
|
|
185
345
|
},
|
|
186
|
-
region: 'us-
|
|
187
|
-
url: 'https://
|
|
346
|
+
region: 'us-west-2',
|
|
347
|
+
url: 'https://awslambdatesturl.testcustomdomain.com/graphql'
|
|
188
348
|
});
|
|
189
349
|
|
|
190
350
|
execute(link, { query }).subscribe({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { ApolloLink, Observable, Operation, FetchResult } from "@apollo/client/core";
|
|
@@ -16,6 +16,7 @@ export declare class AppSyncRealTimeSubscriptionHandshakeLink extends ApolloLink
|
|
|
16
16
|
private subscriptionObserverMap;
|
|
17
17
|
private promiseArray;
|
|
18
18
|
constructor({ url: theUrl, region: theRegion, auth: theAuth }: UrlInfo);
|
|
19
|
+
private isCustomDomain;
|
|
19
20
|
request(operation: Operation): Observable<FetchResult<Record<string, any>, Record<string, any>, Record<string, any>>>;
|
|
20
21
|
private _verifySubscriptionAlreadyStarted;
|
|
21
22
|
private _sendUnsubscriptionMessage;
|
|
@@ -33,5 +34,4 @@ export declare class AppSyncRealTimeSubscriptionHandshakeLink extends ApolloLink
|
|
|
33
34
|
private _errorDisconnect;
|
|
34
35
|
private _timeoutStartSubscriptionAck;
|
|
35
36
|
static createWebSocket(awsRealTimeUrl: string, protocol: string): WebSocket;
|
|
36
|
-
private static _discoverAppSyncRealTimeEndpoint;
|
|
37
37
|
}
|
|
@@ -61,7 +61,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
61
61
|
};
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
63
|
/*!
|
|
64
|
-
* Copyright 2017-
|
|
64
|
+
* Copyright 2017-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
65
65
|
* SPDX-License-Identifier: Apache-2.0
|
|
66
66
|
*/
|
|
67
67
|
var core_1 = require("@apollo/client/core");
|
|
@@ -93,6 +93,8 @@ var START_ACK_TIMEOUT = 15000;
|
|
|
93
93
|
* Default Time in milliseconds to wait for GQL_CONNECTION_KEEP_ALIVE message
|
|
94
94
|
*/
|
|
95
95
|
var DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;
|
|
96
|
+
var standardDomainPattern = /^https:\/\/\w{26}\.appsync\-api\.\w{2}(?:(?:\-\w{2,})+)\-\d\.amazonaws.com\/graphql$/i;
|
|
97
|
+
var customDomainPath = '/realtime';
|
|
96
98
|
var AppSyncRealTimeSubscriptionHandshakeLink = /** @class */ (function (_super) {
|
|
97
99
|
__extends(AppSyncRealTimeSubscriptionHandshakeLink, _super);
|
|
98
100
|
function AppSyncRealTimeSubscriptionHandshakeLink(_a) {
|
|
@@ -107,6 +109,10 @@ var AppSyncRealTimeSubscriptionHandshakeLink = /** @class */ (function (_super)
|
|
|
107
109
|
_this.auth = theAuth;
|
|
108
110
|
return _this;
|
|
109
111
|
}
|
|
112
|
+
// Check if url matches standard domain pattern
|
|
113
|
+
AppSyncRealTimeSubscriptionHandshakeLink.prototype.isCustomDomain = function (url) {
|
|
114
|
+
return url.match(standardDomainPattern) === null;
|
|
115
|
+
};
|
|
110
116
|
AppSyncRealTimeSubscriptionHandshakeLink.prototype.request = function (operation) {
|
|
111
117
|
var _a;
|
|
112
118
|
var _this = this;
|
|
@@ -352,7 +358,7 @@ var AppSyncRealTimeSubscriptionHandshakeLink = /** @class */ (function (_super)
|
|
|
352
358
|
return;
|
|
353
359
|
}
|
|
354
360
|
return new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
355
|
-
var
|
|
361
|
+
var payloadString, headerString, _a, _b, headerQs, payloadQs, discoverableEndpoint, awsRealTimeUrl, err_2;
|
|
356
362
|
return __generator(this, function (_c) {
|
|
357
363
|
switch (_c.label) {
|
|
358
364
|
case 0:
|
|
@@ -362,7 +368,6 @@ var AppSyncRealTimeSubscriptionHandshakeLink = /** @class */ (function (_super)
|
|
|
362
368
|
case 1:
|
|
363
369
|
_c.trys.push([1, 4, , 5]);
|
|
364
370
|
this.socketStatus = types_1.SOCKET_STATUS.CONNECTING;
|
|
365
|
-
discoverableEndpoint = AppSyncRealTimeSubscriptionHandshakeLink._discoverAppSyncRealTimeEndpoint(this.url);
|
|
366
371
|
payloadString = "{}";
|
|
367
372
|
_b = (_a = JSON).stringify;
|
|
368
373
|
return [4 /*yield*/, this._awsRealTimeHeaderBasedAuth({
|
|
@@ -380,6 +385,16 @@ var AppSyncRealTimeSubscriptionHandshakeLink = /** @class */ (function (_super)
|
|
|
380
385
|
headerString = _b.apply(_a, [_c.sent()]);
|
|
381
386
|
headerQs = Buffer.from(headerString).toString("base64");
|
|
382
387
|
payloadQs = Buffer.from(payloadString).toString("base64");
|
|
388
|
+
discoverableEndpoint = appSyncGraphqlEndpoint;
|
|
389
|
+
if (this.isCustomDomain(discoverableEndpoint)) {
|
|
390
|
+
discoverableEndpoint = discoverableEndpoint.concat(customDomainPath);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
discoverableEndpoint = discoverableEndpoint.replace('appsync-api', 'appsync-realtime-api').replace('gogi-beta', 'grt-beta');
|
|
394
|
+
}
|
|
395
|
+
discoverableEndpoint = discoverableEndpoint
|
|
396
|
+
.replace("https://", "wss://")
|
|
397
|
+
.replace('http://', 'ws://');
|
|
383
398
|
awsRealTimeUrl = discoverableEndpoint + "?header=" + headerQs + "&payload=" + payloadQs;
|
|
384
399
|
return [4 /*yield*/, this._initializeRetryableHandshake({ awsRealTimeUrl: awsRealTimeUrl })];
|
|
385
400
|
case 3:
|
|
@@ -760,13 +775,6 @@ var AppSyncRealTimeSubscriptionHandshakeLink = /** @class */ (function (_super)
|
|
|
760
775
|
AppSyncRealTimeSubscriptionHandshakeLink.createWebSocket = function (awsRealTimeUrl, protocol) {
|
|
761
776
|
return new WebSocket(awsRealTimeUrl, protocol);
|
|
762
777
|
};
|
|
763
|
-
AppSyncRealTimeSubscriptionHandshakeLink._discoverAppSyncRealTimeEndpoint = function (url) {
|
|
764
|
-
return url
|
|
765
|
-
.replace("https://", "wss://")
|
|
766
|
-
.replace('http://', 'ws://')
|
|
767
|
-
.replace("appsync-api", "appsync-realtime-api")
|
|
768
|
-
.replace("gogi-beta", "grt-beta");
|
|
769
|
-
};
|
|
770
778
|
return AppSyncRealTimeSubscriptionHandshakeLink;
|
|
771
779
|
}(core_1.ApolloLink));
|
|
772
780
|
exports.AppSyncRealTimeSubscriptionHandshakeLink = AppSyncRealTimeSubscriptionHandshakeLink;
|