diff --git a/src/lib/gramjs/extensions/PromisedWebSockets.js b/src/lib/gramjs/extensions/PromisedWebSockets.js index afaa9b65..d2912ba7 100644 --- a/src/lib/gramjs/extensions/PromisedWebSockets.js +++ b/src/lib/gramjs/extensions/PromisedWebSockets.js @@ -89,8 +89,9 @@ class PromisedWebSockets { reject(error); }; this.client.onclose = (event) => { + const { code, reason, wasClean } = event; // eslint-disable-next-line no-console - console.error(`Socket closed with code: ${event.code}`); + console.error(`Socket ${ip} closed. Code: ${code}, reason: ${reason}, was clean: ${wasClean}`); this.resolveRead(false); this.closed = true; }; diff --git a/src/lib/gramjs/network/MTProtoSender.js b/src/lib/gramjs/network/MTProtoSender.js index 8d80168b..207f99f9 100644 --- a/src/lib/gramjs/network/MTProtoSender.js +++ b/src/lib/gramjs/network/MTProtoSender.js @@ -182,7 +182,9 @@ class MTProtoSender { if (this._updateCallback && attempt === 0) { this._updateCallback(new UpdateConnectionState(UpdateConnectionState.disconnected)); } - this._log.error(`WebSocket connection failed attempt: ${attempt + 1}. Cause: ${err.message}`); + this._log.error(`WebSocket connection failed attempt: ${attempt + 1}`); + // eslint-disable-next-line no-console + console.error(err); await Helpers.sleep(this._delay); } }