Skip to content

Commit f59e8a5

Browse files
author
ludovic
committed
Removed logs
1 parent 3c1d680 commit f59e8a5

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

js-src/Websocket.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export class Websocket {
2525
private pingInterval: NodeJS.Timeout;
2626

2727
private connect(host: string): void {
28-
console.log('Connecting');
2928

3029
this.websocket = new WebSocket(host)
3130

@@ -51,8 +50,6 @@ export class Websocket {
5150
}
5251

5352
if (message.channel) {
54-
console.log(`Received event ${message.event} on channel ${message.channel}`)
55-
5653
if (this.listeners[message.channel] && this.listeners[message.channel][message.event]) {
5754
this.listeners[message.channel][message.event](message.data)
5855
}
@@ -69,7 +66,6 @@ export class Websocket {
6966

7067
this.websocket.onclose = () => {
7168
if (this.socketId && !this.closing || !this.socketId) {
72-
console.info('Connection lost, reconnecting...');
7369
setTimeout(() => {
7470
this.socketId = undefined
7571
this.connect(host)
@@ -80,8 +76,6 @@ export class Websocket {
8076
this.on('whoami', ({ socket_id: socketId }) => {
8177
this.socketId = socketId
8278

83-
console.log(`just set socketId to ${socketId}`)
84-
8579
while (this.channelBacklog.length) {
8680
const channel = this.channelBacklog[0]
8781

@@ -95,7 +89,6 @@ export class Websocket {
9589
// send ping every 60 seconds to keep connection alive
9690
this.pingInterval = setInterval(() => {
9791
if (this.websocket.readyState === this.websocket.OPEN) {
98-
console.log('Sending ping')
9992
this.send({
10093
event: 'ping',
10194
})
@@ -116,7 +109,7 @@ export class Websocket {
116109
try {
117110
return JSON.parse(body)
118111
} catch (error) {
119-
console.error(error)
112+
console.error('Error parsing message', error)
120113

121114
return undefined
122115
}
@@ -159,13 +152,11 @@ export class Websocket {
159152

160153
private actuallySubscribe(channel: Channel): void {
161154
if (channel.name.startsWith('private-') || channel.name.startsWith('presence-')) {
162-
console.log(`Sending auth request for channel ${channel.name}`)
163155

164156
axios.post(this.options.authEndpoint, {
165157
socket_id: this.getSocketId(),
166158
channel_name: channel.name,
167159
}).then((response: AxiosResponse) => {
168-
console.log(`Subscribing to channels ${channel.name}`)
169160

170161
this.send({
171162
event: 'subscribe',
@@ -175,11 +166,9 @@ export class Websocket {
175166
},
176167
})
177168
}).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)
180170
})
181171
} else {
182-
console.log(`Subscribing to channels ${channel.name}`)
183172

184173
this.send({
185174
event: 'subscribe',

0 commit comments

Comments
 (0)