fix error handling, allow building an es6 module

This commit is contained in:
ading2210 2024-01-09 19:36:46 -05:00
parent e4c064401e
commit bb31ef120f
4 changed files with 26 additions and 4 deletions

View file

@ -14,7 +14,7 @@ git clone https://github.com/ading2210/libcurl.js
cd libcurl.js/client
./build.sh
```
Make sure you have emscripten, git, and the various C build tools installed. The build script will generate `client/out/libcurl.js`.
Make sure you have emscripten, git, and the various C build tools installed. The build script will generate `client/out/libcurl.js` as well as `client/out/libcurl_module.mjs`, which is an ES6 module.
## Javascript API:
@ -41,6 +41,12 @@ let r = await libcurl.fetch("https://ading.dev");
console.log(await r.text());
```
### Changing the Websocket URL:
You can change the URL of the websocket proxy by using `libcurl.set_websocket`.
```js
libcurl.set_websocket("ws://localhost:6001/");
```
## Proxy Server:
The proxy server consists of a [SOCKS5 proxy server](https://github.com/Amaindex/asyncio-socks-server) behind a [websocket TCP proxy](https://github.com/novnc/websockify).