Skip to content

Commit

Permalink
feat: reconnect if web socket is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Jun 22, 2024
1 parent ca48fe3 commit fc78bb0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/pages/monitor/[hostname].vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export default {
window.scrollTo(0, document.body.scrollHeight);
}, 100);
};
this.socket.onclose = (event) => {
// reconnect after 1s
setTimeout(() => {
this.fetchData();
}, 1000);
}
},
},
};
Expand Down

0 comments on commit fc78bb0

Please sign in to comment.