From bffbf8ee6ea46a3ddfbb777e65e1e2632180c214 Mon Sep 17 00:00:00 2001 From: Kim Huebel Date: Sun, 27 Dec 2020 14:36:06 +0000 Subject: [PATCH] some performance tuning Just call Websockets only if really needed by shown tabs --- html/index.html | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/html/index.html b/html/index.html index 7209e61..f034910 100644 --- a/html/index.html +++ b/html/index.html @@ -291,10 +291,12 @@ "order": [[ 0, "desc" ]] } ); - var ws3 = new WebSocket("ws://" + window.location.hostname + ":5678/SYSINFO"); - ws3.onmessage = function (event) { - getSysInfo(document, event); - }; + if (showSysInfoTab) { + var ws3 = new WebSocket("ws://" + window.location.hostname + ":5678/SYSINFO"); + ws3.onmessage = function (event) { + getSysInfo(document, event); + }; + } var ws1 = new WebSocket("ws://" + window.location.hostname + ":5678/MMDVM"); ws1.onmessage = function (event) { @@ -323,12 +325,13 @@ t_qso.row('.selected').remove().draw( false ); } ); - var ws2 = new WebSocket("ws://" + window.location.hostname + ":5678/DAPNET"); - ws2.onmessage = function (event) { - getDapnetMessages(document, event); - }; - t_dapnet.order( [ 0, 'desc' ] ).draw(); - + if (showDAPNETMessagesTab) { + var ws2 = new WebSocket("ws://" + window.location.hostname + ":5678/DAPNET"); + ws2.onmessage = function (event) { + getDapnetMessages(document, event); + }; + t_dapnet.order( [ 0, 'desc' ] ).draw(); + }