@@ -25,7 +25,6 @@ export class Websocket {
25
25
private pingInterval : NodeJS . Timeout ;
26
26
27
27
private connect ( host : string ) : void {
28
- console . log ( 'Connecting' ) ;
29
28
30
29
this . websocket = new WebSocket ( host )
31
30
@@ -51,8 +50,6 @@ export class Websocket {
51
50
}
52
51
53
52
if ( message . channel ) {
54
- console . log ( `Received event ${ message . event } on channel ${ message . channel } ` )
55
-
56
53
if ( this . listeners [ message . channel ] && this . listeners [ message . channel ] [ message . event ] ) {
57
54
this . listeners [ message . channel ] [ message . event ] ( message . data )
58
55
}
@@ -69,7 +66,6 @@ export class Websocket {
69
66
70
67
this . websocket . onclose = ( ) => {
71
68
if ( this . socketId && ! this . closing || ! this . socketId ) {
72
- console . info ( 'Connection lost, reconnecting...' ) ;
73
69
setTimeout ( ( ) => {
74
70
this . socketId = undefined
75
71
this . connect ( host )
@@ -80,8 +76,6 @@ export class Websocket {
80
76
this . on ( 'whoami' , ( { socket_id : socketId } ) => {
81
77
this . socketId = socketId
82
78
83
- console . log ( `just set socketId to ${ socketId } ` )
84
-
85
79
while ( this . channelBacklog . length ) {
86
80
const channel = this . channelBacklog [ 0 ]
87
81
@@ -95,7 +89,6 @@ export class Websocket {
95
89
// send ping every 60 seconds to keep connection alive
96
90
this . pingInterval = setInterval ( ( ) => {
97
91
if ( this . websocket . readyState === this . websocket . OPEN ) {
98
- console . log ( 'Sending ping' )
99
92
this . send ( {
100
93
event : 'ping' ,
101
94
} )
@@ -116,7 +109,7 @@ export class Websocket {
116
109
try {
117
110
return JSON . parse ( body )
118
111
} catch ( error ) {
119
- console . error ( error )
112
+ console . error ( 'Error parsing message' , error )
120
113
121
114
return undefined
122
115
}
@@ -159,13 +152,11 @@ export class Websocket {
159
152
160
153
private actuallySubscribe ( channel : Channel ) : void {
161
154
if ( channel . name . startsWith ( 'private-' ) || channel . name . startsWith ( 'presence-' ) ) {
162
- console . log ( `Sending auth request for channel ${ channel . name } ` )
163
155
164
156
axios . post ( this . options . authEndpoint , {
165
157
socket_id : this . getSocketId ( ) ,
166
158
channel_name : channel . name ,
167
159
} ) . then ( ( response : AxiosResponse ) => {
168
- console . log ( `Subscribing to channels ${ channel . name } ` )
169
160
170
161
this . send ( {
171
162
event : 'subscribe' ,
@@ -175,11 +166,9 @@ export class Websocket {
175
166
} ,
176
167
} )
177
168
} ) . catch ( ( error ) => {
178
- console . log ( `Auth request for channel ${ channel . name } failed` )
179
- console . error ( error )
169
+ console . error ( 'Error while subscribing to private channel :' , error )
180
170
} )
181
171
} else {
182
- console . log ( `Subscribing to channels ${ channel . name } ` )
183
172
184
173
this . send ( {
185
174
event : 'subscribe' ,
0 commit comments