diff --git a/packages/aws-appsync-subscription-link/src/realtime-subscription-handshake-link.ts b/packages/aws-appsync-subscription-link/src/realtime-subscription-handshake-link.ts index e8a4348a..fde9b1cd 100644 --- a/packages/aws-appsync-subscription-link/src/realtime-subscription-handshake-link.ts +++ b/packages/aws-appsync-subscription-link/src/realtime-subscription-handshake-link.ts @@ -62,15 +62,16 @@ export class AppSyncRealTimeSubscriptionHandshakeLink extends ApolloLink { private awsRealTimeSocket: WebSocket; private socketStatus: SOCKET_STATUS = SOCKET_STATUS.CLOSED; private keepAliveTimeoutId; - private keepAliveTimeout = DEFAULT_KEEP_ALIVE_TIMEOUT; + private keepAliveTimeout; private subscriptionObserverMap: Map = new Map(); private promiseArray: Array<{ res: Function; rej: Function }> = []; - constructor({ url: theUrl, region: theRegion, auth: theAuth }: UrlInfo) { + constructor({ url: theUrl, region: theRegion, auth: theAuth, keepAliveTimeout: keepAliveTimeout }: UrlInfo) { super(); this.url = theUrl; this.region = theRegion; this.auth = theAuth; + this.keepAliveTimeout = keepAliveTimeout || DEFAULT_KEEP_ALIVE_TIMEOUT; } request(operation: Operation) { diff --git a/packages/aws-appsync-subscription-link/src/types/index.ts b/packages/aws-appsync-subscription-link/src/types/index.ts index 82d8a07e..6f83bc72 100644 --- a/packages/aws-appsync-subscription-link/src/types/index.ts +++ b/packages/aws-appsync-subscription-link/src/types/index.ts @@ -81,6 +81,7 @@ export type UrlInfo = { url: string; auth: AuthOptions; region: string; + keepAliveTimeout?: number; }; export type ObserverQuery = {