--- a/svghmi/svghmi.js Thu Oct 27 10:52:24 2022 +0200
+++ b/svghmi/svghmi.js Fri Oct 28 09:44:33 2022 +0200
@@ -586,20 +586,21 @@
switch_page(default_page);
-// var periodic_reconnect_timer;
+var periodic_reconnect_timer; // Once connection established
function ws_onopen(evt) {
- // to force reconnect every hour
- if(periodic_reconnect_timer){
- window.clearTimeout(periodic_reconnect_timer);
+ // Work around memory leak with websocket on QtWebEngine + // reconnect every hour to force deallocate websocket garbage + if(window.navigator.userAgent.includes("QtWebEngine")){ + if(periodic_reconnect_timer){ + window.clearTimeout(periodic_reconnect_timer); + periodic_reconnect_timer = window.setTimeout(() => { + periodic_reconnect_timer = null; - periodic_reconnect_timer = window.setTimeout(() => {
- periodic_reconnect_timer = null;
// forget subscriptions remotely