mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix
This commit is contained in:
parent
50079e7a96
commit
f1b2c8b1cf
@ -36,11 +36,14 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
if (this.connection) {
|
if (this.connection) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.heartbeatRef = setInterval(() => {
|
if (this.heartbeatIntervalInMillis > 0) {
|
||||||
if (this.connection && this.connection.readyState === WebSocket.OPEN) {
|
this.heartbeatRef = setInterval(() => {
|
||||||
this.connection.send(JSON.stringify(new OB11HeartbeatEvent(this.core, this.heartbeatIntervalInMillis, this.core.selfInfo.online ?? true, true)));
|
if (this.connection && this.connection.readyState === WebSocket.OPEN) {
|
||||||
}
|
this.connection.send(JSON.stringify(new OB11HeartbeatEvent(this.core, this.heartbeatIntervalInMillis, this.core.selfInfo.online ?? true, true)));
|
||||||
}, this.heartbeatIntervalInMillis);
|
}
|
||||||
|
}, this.heartbeatIntervalInMillis);
|
||||||
|
}
|
||||||
|
|
||||||
await this.tryConnect();
|
await this.tryConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,10 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter {
|
|||||||
this.logger.log('[OneBot] [WebSocket Server] Server Started', typeof (addressInfo) === 'string' ? addressInfo : addressInfo?.address + ':' + addressInfo?.port);
|
this.logger.log('[OneBot] [WebSocket Server] Server Started', typeof (addressInfo) === 'string' ? addressInfo : addressInfo?.address + ':' + addressInfo?.port);
|
||||||
|
|
||||||
this.isOpen = true;
|
this.isOpen = true;
|
||||||
this.registerHeartBeat();
|
if (this.heartbeatInterval > 0) {
|
||||||
|
this.registerHeartBeat();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async close() {
|
async close() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user