Skip to content

Commit

Permalink
Fix: web console: prevent concurrent websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
schlimmchen committed Feb 4, 2025
1 parent 80a84e5 commit 3c0feb0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions webapp/src/views/ConsoleInfoView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,17 @@ export default defineComponent({
this.closeSocket();
};
},
// Send heartbeat packets regularly * 59s Send a heartbeat
// Send heartbeat packets regularly * 5s Send a heartbeat
heartCheck() {
if (this.heartInterval) {
clearTimeout(this.heartInterval);
clearInterval(this.heartInterval);
}
this.heartInterval = setInterval(() => {
if (this.socket.readyState === 1) {
if (this.socket.readyState === WebSocket.OPEN) {
// Connection status
this.socket.send('ping');
} else {
clearInterval(this.heartInterval);
this.initSocket(); // Breakpoint reconnection 5 Time
}
}, 5 * 1000);
Expand All @@ -129,7 +130,7 @@ export default defineComponent({
}
if (this.heartInterval) {
clearTimeout(this.heartInterval);
clearInterval(this.heartInterval);
}
},
getOutDate(): string {
Expand Down

0 comments on commit 3c0feb0

Please sign in to comment.