sS hSilentComputator() { int port = subBot_currentPort(); ret hSilentComputator( (subBot_isHttps() ? "wss://" : "ws://") + domain() + (port == 80 ? "" : ":" + port) + "/"); } sS hSilentComputator(S wsUri) { ret div("Calculating", id := 'calcing) + hcss([[#calcing { position: fixed; width: 100%; height: 100vh; z-index: 9999; visibility: hidden; }]]) + hreconnectingWebSockets() + hjavascript([[ function sendPing() { ${PINGCMD} } var working = false; var ws = new ReconnectingWebSocket("${URI}"); ws.onmessage = function(event) { var d = event.data; while (d.length > 0 && d.charCodeAt(d.length-1) == 0) d = d.substring(0, d.length-1); console.log("Evaluating: " + d); eval(d); console.log("Evaluated."); }; //working = true; // XXX //console.log("Eval test: " + eval('working')); ]].replace("${URI}", wsUri) .replace("${PINGCMD}", nodes_pingCmd())); }