chore: 心跳

This commit is contained in:
手瓜一十雪
2024-08-11 10:12:53 +08:00
parent fc2fe0a873
commit 6b0798542e
2 changed files with 18 additions and 6 deletions

View File

@@ -31,7 +31,7 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
if (this.connection) {
this.heartbeatTimer = setInterval(() => {
if (this.connection && this.connection.readyState === NodeWebSocket.OPEN) {
this.connection.ping(JSON.stringify(new OB11HeartbeatEvent(this.coreContext, this.heartbeatInterval, this.coreContext.selfInfo.online, true)));
this.connection.send(JSON.stringify(new OB11HeartbeatEvent(this.coreContext, this.heartbeatInterval, this.coreContext.selfInfo.online, true)));
}
}, this.heartbeatInterval);
}