GramJs: Add more connection logging

This commit is contained in:
Alexander Zinchuk 2021-07-21 17:44:57 +03:00
parent a12d8afb76
commit 7ceff64489
2 changed files with 5 additions and 2 deletions

View File

@ -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;
};

View File

@ -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);
}
}