From 04839c3a262df5a67e0647a6cd291be4e3dfd396 Mon Sep 17 00:00:00 2001 From: saber-nyan Date: Sat, 11 May 2019 01:17:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BE=D0=B1=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/views/Home.vue b/src/views/Home.vue index c9c2109..70465fd 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -33,6 +33,7 @@ export default { showSettingsModal: false, showAddServiceModal: false, socket: null, + navbarTimer: null, } }, props: ['servicePort', 'streamId',], @@ -42,6 +43,9 @@ export default { }, connectWs() { const wsUrl = this.$store.state.apiUrl + '/ws'; + // FIXME: нельзя посылать заголовок авторизации (может появиться окно с авторизацией, что не круто), + // FIXME: нужно либо убрать его на эндпоинте, либо использовать другой способ + // FIXME: (https://groups.google.com/forum/#!topic/sockjs/4gmZy8XZFIY) this.socket = new SockJS(wsUrl); this.socket.onopen = function () { console.debug('WS connected'); @@ -70,9 +74,11 @@ export default { }, mounted() { this.connectWs(); + this.navbarTimer = setInterval(this.reloadNavbar, 4000); // TODO: некрасиво, лучше ловить через WS }, beforeDestroy() { this.socket.close(); + clearInterval(this.navbarTimer); }, components: { AddServiceModal,