sS hSilentComputator() { ret hSilentComputator(hSilentComputator_defaultURI()); } sS hSilentComputator(S wsUri) { ret hSilentComputator(wsUri, ""); } sS hSilentComputator(S wsUri, S flag) { if (nempty(flag)) wsUri = addSlash(wsUri) + flag; ret div("Calculating", id := 'calcing) + hcss([[#calcing { position: fixed; width: 100%; height: 100vh; z-index: 9999; visibility: hidden; }]]) + hMakeComputerID() + hreconnectingWebSockets() + hjavascript([[ function sendPing() { ${PINGCMD} } var working = false; var benchResultl; var ws = new ReconnectingWebSocket("${URI}"); ws.onopen = function(event) { console.log("WebSocket opened."); }; 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); var geval = eval; // use global scope geval(d); console.log("Evaluated."); }; //working = true; // XXX //console.log("Eval test: " + eval('working')); ]].replace("${URI}", wsUri) .replace("${PINGCMD}", nodes_pingCmd())); }