From 3df42e1f3807271b65fa93606ba766070d76d98f Mon Sep 17 00:00:00 2001 From: vishtree Date: Tue, 25 Jan 2022 09:42:11 +0100 Subject: [PATCH] fix: added missing logs for wsconnection --- src/connection.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/connection.ts b/src/connection.ts index 2ecfb704e..8ad9ddabf 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -271,9 +271,11 @@ export class StableWSConnection< this.requestID = randomId(); this.client.insightMetrics.connectionStartTimestamp = new Date().getTime(); try { + this._log(`_connect() - waiting for token`); await this.client.tokenManager.tokenReady(); this._setupConnectionPromise(); const wsURL = this._buildUrl(); + this._log(`_connect() - Connecting to ${wsURL}`, { wsURL, requestID: this.requestID }); this.ws = new WebSocket(wsURL); this.ws.onopen = this.onopen.bind(this, this.wsID); this.ws.onclose = this.onclose.bind(this, this.wsID); @@ -412,6 +414,7 @@ export class StableWSConnection< onmessage = (wsID: number, event: WebSocket.MessageEvent) => { if (this.wsID !== wsID) return; + this._log('onmessage() - onmessage callback', { event, wsID }); const data = typeof event.data === 'string' ? JSON.parse(event.data) : null; // we wait till the first message before we consider the connection open.. @@ -430,7 +433,6 @@ export class StableWSConnection< // trigger the event.. this.lastEvent = new Date(); - this._log('onmessage() - onmessage callback', { event, wsID }); if (data && data.type === 'health.check') { this.scheduleNextPing();