mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-12 14:00:01 -04:00
don't hardcode websocket url
This commit is contained in:
parent
663f31cd6e
commit
57d1245c40
2 changed files with 7 additions and 5 deletions
|
@ -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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue