mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: 反向ws
This commit is contained in:
parent
0c6aac7f66
commit
eeec905df0
@ -43,7 +43,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
}
|
}
|
||||||
}, this.config.heartInterval);
|
}, this.config.heartInterval);
|
||||||
}
|
}
|
||||||
|
this.isEnable = true;
|
||||||
await this.tryConnect();
|
await this.tryConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async tryConnect() {
|
private async tryConnect() {
|
||||||
if (!this.connection && !this.isEnable) {
|
if (!this.connection && this.isEnable) {
|
||||||
let isClosedByError = false;
|
let isClosedByError = false;
|
||||||
|
|
||||||
this.connection = new WebSocket(this.config.url, {
|
this.connection = new WebSocket(this.config.url, {
|
||||||
@ -106,7 +106,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
if (!isClosedByError) {
|
if (!isClosedByError) {
|
||||||
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 反向WebSocket (${this.config.url}) 连接意外关闭`);
|
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 反向WebSocket (${this.config.url}) 连接意外关闭`);
|
||||||
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 在 ${Math.floor(this.config.reconnectInterval / 1000)} 秒后尝试重新连接`);
|
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 在 ${Math.floor(this.config.reconnectInterval / 1000)} 秒后尝试重新连接`);
|
||||||
if (!this.isEnable) {
|
if (this.isEnable) {
|
||||||
this.connection = null;
|
this.connection = null;
|
||||||
setTimeout(() => this.tryConnect(), this.config.reconnectInterval);
|
setTimeout(() => this.tryConnect(), this.config.reconnectInterval);
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
isClosedByError = true;
|
isClosedByError = true;
|
||||||
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 反向WebSocket (${this.config.url}) 连接错误`, err);
|
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 反向WebSocket (${this.config.url}) 连接错误`, err);
|
||||||
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 在 ${Math.floor(this.config.reconnectInterval / 1000)} 秒后尝试重新连接`);
|
this.logger.logError.bind(this.logger)(`[OneBot] [WebSocket Client] 在 ${Math.floor(this.config.reconnectInterval / 1000)} 秒后尝试重新连接`);
|
||||||
if (!this.isEnable) {
|
if (this.isEnable) {
|
||||||
this.connection = null;
|
this.connection = null;
|
||||||
setTimeout(() => this.tryConnect(), this.config.reconnectInterval);
|
setTimeout(() => this.tryConnect(), this.config.reconnectInterval);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user