@@ -5,7 +5,7 @@ export type Options = { authEndpoint: string, host: string, bearerToken: string,
55
66export type MessageBody = { event : string , channel ?: string , data : object } ;
77
8- const LOG_PREFIX = '[AG-WS] ' ;
8+ const LOG_PREFIX = '[AG-WS]' ;
99
1010export class Websocket {
1111 buffer : Array < object > = [ ] ;
@@ -28,7 +28,7 @@ export class Websocket {
2828 private pingInterval : NodeJS . Timeout ;
2929
3030 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...' ) ;
3232
3333 this . websocket = new WebSocket ( host ) ;
3434
@@ -44,7 +44,7 @@ export class Websocket {
4444 } ;
4545
4646 this . websocket . onopen = ( ) => {
47- this . options . debug && console . log ( LOG_PREFIX + 'Connected !' ) ;
47+ this . options . debug && console . log ( LOG_PREFIX + ' Connected !' ) ;
4848 this . hasConnected = true ;
4949
5050 this . send ( {
@@ -63,7 +63,7 @@ export class Websocket {
6363
6464 this . websocket . onmessage = ( messageEvent : MessageEvent ) => {
6565 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 ) ;
6767
6868 if ( ! message ) {
6969 return ;
@@ -88,7 +88,7 @@ export class Websocket {
8888 // send ping every 60 seconds to keep connection alive
8989 this . pingInterval = setInterval ( ( ) => {
9090 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' ) ;
9292
9393 this . send ( {
9494 event : 'ping' ,
@@ -117,7 +117,7 @@ export class Websocket {
117117 this . on ( 'whoami' , ( { socket_id : socketId } ) => {
118118 this . socketId = socketId ;
119119
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 } ` ) ;
121121
122122 // Handle the backlog and don't empty it, we'll need it if we lose connection
123123 let channel : Channel ;
@@ -195,7 +195,7 @@ export class Websocket {
195195 } , {
196196 headers : this . options . auth . headers || { }
197197 } ) . 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 } ` ) ;
199199
200200 this . send ( {
201201 event : 'subscribe' ,
@@ -209,7 +209,7 @@ export class Websocket {
209209 this . options . debug && console . error ( error ) ;
210210 } )
211211 } 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 } ` ) ;
213213
214214 this . send ( {
215215 event : 'subscribe' ,
0 commit comments