svghmi/svghmi.js
changeset 3650 9256c344c2da
parent 3648 ff42600fddd7
child 3653 d5ff60e906b0
equal deleted inserted replaced
3649:61fa60130ad6 3650:9256c344c2da
   584 
   584 
   585 // show main page
   585 // show main page
   586 switch_page(default_page);
   586 switch_page(default_page);
   587 
   587 
   588 var reconnect_delay = 0;
   588 var reconnect_delay = 0;
   589 // var periodic_reconnect_timer;
   589 var periodic_reconnect_timer;
   590 
   590 
   591 // Once connection established
   591 // Once connection established
   592 function ws_onopen(evt) {
   592 function ws_onopen(evt) {
   593     /* 
   593     // Work around memory leak with websocket on QtWebEngine
   594     // to force reconnect every hour
   594     // reconnect every hour to force deallocate websocket garbage
   595     if(periodic_reconnect_timer){
   595     if(window.navigator.userAgent.includes("QtWebEngine")){
   596         window.clearTimeout(periodic_reconnect_timer);
   596         if(periodic_reconnect_timer){
   597     }
   597             window.clearTimeout(periodic_reconnect_timer);
   598     periodic_reconnect_timer = window.setTimeout(() => {
   598         }
   599         ws.close();
   599         periodic_reconnect_timer = window.setTimeout(() => {
   600         periodic_reconnect_timer = null;
   600             ws.close();
   601     }, 3600*1000);
   601             periodic_reconnect_timer = null;
   602     */
   602         }, 3600000);
       
   603     }
   603 
   604 
   604     // forget subscriptions remotely
   605     // forget subscriptions remotely
   605     send_reset();
   606     send_reset();
   606 
   607 
   607     // forget earlier subscriptions locally
   608     // forget earlier subscriptions locally