mirror of
https://github.com/Av0idD4rk/packmate.git
synced 2026-10-23 21:42:06 +00:00
Исправил таймаут WS
This commit is contained in:
parent
43591bd269
commit
824bec994c
@ -40,8 +40,7 @@ export default {
|
||||
reloadNavbar() {
|
||||
this.$refs.navbar.getCtfServices();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
connectWs() {
|
||||
const wsUrl = this.$store.state.apiUrl + '/ws';
|
||||
this.socket = new SockJS(wsUrl);
|
||||
this.socket.onopen = function () {
|
||||
@ -49,6 +48,10 @@ export default {
|
||||
};
|
||||
this.socket.onclose = function (ev) {
|
||||
console.debug('WS disconnected', ev.code, ev.reason);
|
||||
if (ev.code === 1008) {
|
||||
console.info('Security timeout, reconnecting...');
|
||||
this.connectWs();
|
||||
}
|
||||
};
|
||||
this.socket.onmessage = ev => {
|
||||
const parsed = JSON.parse(ev.data);
|
||||
@ -64,6 +67,10 @@ export default {
|
||||
console.warn('WS err', ev);
|
||||
};
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.connectWs();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.socket.close();
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user