1+ import { EventEmitter } from "node:events" ;
12import type RingCentral from "@rc-ex/core" ;
23import type SubscriptionInfo from "@rc-ex/core/definitions/SubscriptionInfo" ;
34import RestException from "@rc-ex/core/RestException" ;
@@ -7,7 +8,6 @@ import type {
78 RestRequestConfig ,
89 RestResponse ,
910} from "@rc-ex/core/types" ;
10- import { EventEmitter } from "events" ;
1111import hyperid from "hyperid" ;
1212import type { MessageEvent } from "isomorphic-ws" ;
1313import WS from "isomorphic-ws" ;
@@ -233,7 +233,7 @@ class WebSocketExtension extends SdkExtension {
233233 if ( this . ws ?. readyState === OPEN || this . ws ?. readyState === CONNECTING ) {
234234 return ;
235235 }
236- if ( ! this . wsc || ! this . wsc . token ) {
236+ if ( ! this . wsc ? .token ) {
237237 await this . connect ( false ) ; // connect to WSG but do not recover
238238 return ;
239239 }
@@ -275,7 +275,7 @@ class WebSocketExtension extends SdkExtension {
275275 } ,
276276 ] ) ,
277277 ) ;
278- } catch ( e ) {
278+ } catch ( _e ) {
279279 this . ws . close ( ) ; // Explicitly mark WS as closed
280280 }
281281 }
@@ -367,7 +367,7 @@ class WebSocketExtension extends SdkExtension {
367367 this . eventEmitter . emit ( Events . connectionReady , this . ws ) ;
368368
369369 // recover the subscription, if it exists and enabled
370- if ( this . subscription && this . subscription . enabled ) {
370+ if ( this . subscription ? .enabled ) {
371371 // because we have a new ws object
372372 this . subscription . setupWsEventListener ( ) ;
373373 if (
0 commit comments