This commit is contained in:
手瓜一十雪 committed 2024-11-15 15:24:44 +08:00
1 parent 50079e7a96
commit f1b2c8b1cf
2 files changed
+12 -6

No files matched your search

+8 -5
View File
@@ -36,11 +36,14 @@ export class OB11ActiveWebSocketAdapter implements IOB11NetworkAdapter {
if (this.connection) {
return;
}
this.heartbeatRef = setInterval(() => {
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);
if (this.heartbeatIntervalInMillis > 0) {
this.heartbeatRef = setInterval(() => {
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);
}
await this.tryConnect();
}