@@ -5,7 +5,7 @@ export type Options = { authEndpoint: string, host: string, bearerToken: string,
5
5
6
6
export type MessageBody = { event : string , channel ?: string , data : object } ;
7
7
8
- const LOG_PREFIX = '[AG-WS] ' ;
8
+ const LOG_PREFIX = '[AG-WS]' ;
9
9
10
10
export class Websocket {
11
11
buffer : Array < object > = [ ] ;
@@ -28,7 +28,7 @@ export class Websocket {
28
28
private pingInterval : NodeJS . Timeout ;
29
29
30
30
private connect ( host : string ) : void {
31
- this . options . debug && console . log ( LOG_PREFIX + 'Trying to connect...' ) ;
31
+ this . options . debug && console . log ( LOG_PREFIX + ' Trying to connect...' ) ;
32
32
33
33
this . websocket = new WebSocket ( host ) ;
34
34
@@ -44,7 +44,7 @@ export class Websocket {
44
44
} ;
45
45
46
46
this . websocket . onopen = ( ) => {
47
- this . options . debug && console . log ( LOG_PREFIX + 'Connected !' ) ;
47
+ this . options . debug && console . log ( LOG_PREFIX + ' Connected !' ) ;
48
48
this . hasConnected = true ;
49
49
50
50
this . send ( {
@@ -63,7 +63,7 @@ export class Websocket {
63
63
64
64
this . websocket . onmessage = ( messageEvent : MessageEvent ) => {
65
65
const message = this . parseMessage ( messageEvent . data ) ;
66
- this . options . debug && console . log ( LOG_PREFIX + 'onmessage' , messageEvent . data ) ;
66
+ this . options . debug && console . log ( LOG_PREFIX + ' onmessage' , messageEvent . data ) ;
67
67
68
68
if ( ! message ) {
69
69
return ;
@@ -88,7 +88,7 @@ export class Websocket {
88
88
// send ping every 60 seconds to keep connection alive
89
89
this . pingInterval = setInterval ( ( ) => {
90
90
if ( this . websocket . readyState === this . websocket . OPEN ) {
91
- this . options . debug && console . log ( LOG_PREFIX + 'Sending ping' ) ;
91
+ this . options . debug && console . log ( LOG_PREFIX + ' Sending ping' ) ;
92
92
93
93
this . send ( {
94
94
event : 'ping' ,
@@ -117,7 +117,7 @@ export class Websocket {
117
117
this . on ( 'whoami' , ( { socket_id : socketId } ) => {
118
118
this . socketId = socketId ;
119
119
120
- this . options . debug && console . log ( `${ LOG_PREFIX } just set socketId to ${ socketId } ` ) ;
120
+ this . options . debug && console . log ( `${ LOG_PREFIX } Just set socketId to ${ socketId } ` ) ;
121
121
122
122
// Handle the backlog and don't empty it, we'll need it if we lose connection
123
123
let channel : Channel ;
@@ -195,7 +195,7 @@ export class Websocket {
195
195
} , {
196
196
headers : this . options . auth . headers || { }
197
197
} ) . then ( ( response : AxiosResponse ) => {
198
- this . options . debug && console . log ( `${ LOG_PREFIX } Subscribing to channels ${ channel . name } ` ) ;
198
+ this . options . debug && console . log ( `${ LOG_PREFIX } Subscribing to private channel ${ channel . name } ` ) ;
199
199
200
200
this . send ( {
201
201
event : 'subscribe' ,
@@ -209,7 +209,7 @@ export class Websocket {
209
209
this . options . debug && console . error ( error ) ;
210
210
} )
211
211
} else {
212
- this . options . debug && console . log ( `${ LOG_PREFIX } Subscribing to channels ${ channel . name } ` ) ;
212
+ this . options . debug && console . log ( `${ LOG_PREFIX } Subscribing to channel ${ channel . name } ` ) ;
213
213
214
214
this . send ( {
215
215
event : 'subscribe' ,
0 commit comments