don't hardcode websocket url

This commit is contained in:
ading2210 2024-01-07 19:57:44 -05:00
parent 663f31cd6e
commit 57d1245c40
2 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,3 @@
const cacert_path = "./out/cacert.pem";
const websocket_url = `wss://${location.hostname}/ws`;
const status_messages = {
@ -218,14 +217,18 @@ function libcurl_fetch(url, params={}) {
})
}
function set_websocket_url(url) {
Module.websocket.url = url;
}
async function main() {
console.log("emscripten module loaded");
_load_certs();
set_websocket_url(websocket_url);
console.log(await libcurl_fetch("https://httpbin.org/anything"));
}
window.onload = () => {
console.log("page loaded, waiting for emscripten module load");
//Module.websocket.url = websocket_url;
Module.onRuntimeInitialized = main;
};