sS hInitWebSocket(O... _) { optPar S onOpen; optPar S onMessage; optPar S readyMsg = "WebSocket ready!"; ret hreconnectingWebSockets() + hscript([[ var wsReady = false; var ws = new ReconnectingWebSocket(((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + "/"); ws.onopen = function(event) { console.log(]] + readyMsg + [[); ]] + unnull(onOpen) + [[ }; ws.onmessage = function(event) { ]] + unnull(onMessage) + [[ }; ]]); }