@@ -24,7 +24,7 @@ export class ApiManager {
24
24
private derivApi : TDerivApi ;
25
25
private pingInterval : NodeJS . Timer ;
26
26
private reconnectInterval : NodeJS . Timer ;
27
- private websocket_connected : ( connection_value ) => boolean ;
27
+ private is_websocket_connected : ( connection_value ) => boolean ;
28
28
private is_websocket_authorized : ( connection_value ) => boolean ;
29
29
30
30
public static instance : ApiManager ;
@@ -57,8 +57,8 @@ export class ApiManager {
57
57
}
58
58
59
59
public authorize ( token : string , setIsConnected , setIsAuthorized ) {
60
- this . websocket_connected = setIsConnected ;
61
- this . websocket_authorize = setIsAuthorized ;
60
+ this . is_websocket_connected = setIsConnected ;
61
+ this . is_websocket_authorized = setIsAuthorized ;
62
62
return this . derivApi . authorize ( { authorize : token } ) ;
63
63
}
64
64
public logout ( ) {
@@ -73,15 +73,15 @@ export class ApiManager {
73
73
clearInterval ( this . reconnectInterval ) ;
74
74
}
75
75
this . socket . addEventListener ( 'open' , ( ) => {
76
- this . websocket_connected && this . websocket_connected ( true ) ;
76
+ this . is_websocket_connected ?. ( true ) ;
77
77
this . pingInterval = setInterval ( ( ) => {
78
78
this . socket . send ( JSON . stringify ( { ping : 1 } ) ) ;
79
79
} , PING_INTERVAL ) ;
80
80
} ) ;
81
81
82
82
this . socket . addEventListener ( 'close' , ( ) => {
83
- this . websocket_connected && this . websocket_connected ( false ) ;
84
- this . websocket_authorize && this . websocket_authorize ( false ) ;
83
+ this . is_websocket_connected ?. ( false ) ;
84
+ this . is_websocket_authorized ?. ( false ) ;
85
85
clearInterval ( this . pingInterval ) ;
86
86
this . socket = null ;
87
87
if ( attempts > 0 ) {
0 commit comments