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