@@ -71,10 +71,6 @@ enum MessageType {
7171 GQL_ERROR = 'error' ,
7272}
7373
74- const RETRYABLE_ERRORED_SUBSCRIPTIONS_RETRY_LIMIT = 3 ;
75- // To avoid haveAnySubscriptionsErrored returning 'false' temporarily if retrying errored subscriptions fails.
76- const RETRYABLE_ERRORED_SUBSCRIPTIONS_SUCCEEDED_DELAY_MS = 500 ;
77-
7874const NON_RETRYABLE_SUBSCRIPTION_ERROR_TYPES = [
7975 'BAD_REQUEST' ,
8076 'FIELD_NOT_FOUND' ,
@@ -85,8 +81,13 @@ const NON_RETRYABLE_SUBSCRIPTION_ERROR_TYPES = [
8581 'ValidationError' ,
8682] as const ;
8783
88- const PONG_TIMEOUT_IN_MS = 12_000 ;
89- const PING_PONG_INTERVAL_IN_MS = 20_000 ;
84+ const RETRYABLE_ERRORED_SUBSCRIPTIONS_RETRY_LIMIT = 5 ;
85+
86+ // To avoid haveAnySubscriptionsErrored returning 'false' temporarily if retrying errored subscriptions fails.
87+ const RETRYABLE_ERRORED_SUBSCRIPTIONS_SUCCEEDED_DELAY_MS = 1_000 ;
88+
89+ const PONG_TIMEOUT_IN_MS = 2_000 ;
90+ const PING_PONG_INTERVAL_IN_MS = 2_000 ;
9091
9192// https://www.w3.org/TR/websockets/#concept-websocket-close-fail
9293const CLIENT_SIDE_CLOSE_EVENT = 1000 ;
@@ -174,7 +175,6 @@ export class GraphqlService {
174175
175176 private pongTimeout : any ;
176177 private pingPongInterval : any ;
177- private readonly sendPingWithThisBound = this . sendPing . bind ( this ) ;
178178
179179 private connectionAttemptsCount = 0 ;
180180
@@ -654,16 +654,20 @@ export class GraphqlService {
654654 }
655655
656656 private monitorWithPingPong ( ) : void {
657- this . pingPongInterval = setInterval (
658- this . sendPingWithThisBound ,
659- PING_PONG_INTERVAL_IN_MS ,
660- ) ;
657+ this . pingPongInterval = setInterval ( ( ) => {
658+ this . sendPing ( ) ;
659+ } , PING_PONG_INTERVAL_IN_MS ) ;
661660 }
662661
663662 private monitorWithOfflineEvent ( ) : void {
664663 if ( typeof window !== 'undefined' ) {
665- window . removeEventListener ( 'offline' , this . sendPingWithThisBound ) ;
666- window . addEventListener ( 'offline' , this . sendPingWithThisBound ) ;
664+ window . removeEventListener ( 'offline' , ( ) => {
665+ this . sendPing ( ) ;
666+ } ) ;
667+
668+ window . addEventListener ( 'offline' , ( ) => {
669+ this . sendPing ( ) ;
670+ } ) ;
667671 }
668672 }
669673
0 commit comments