diff --git a/.gitmodules b/.gitmodules index f2422e2..46e8a75 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[submodule "client/wisp_client"] + path = client/wisp_client + url = https://github.com/MercuryWorkshop/wisp-client-js [submodule "server/wisp_server"] path = server/wisp_server url = https://github.com/MercuryWorkshop/wisp-server-python diff --git a/client/build.sh b/client/build.sh index 9f32547..ec390aa 100755 --- a/client/build.sh +++ b/client/build.sh @@ -8,7 +8,7 @@ BUILD_DIR="build" C_DIR="libcurl" FRAGMENTS_DIR="fragments" JAVSCRIPT_DIR="javascript" -WISP_CLIENT="$BUILD_DIR/wisp-js/package" +WISP_CLIENT="wisp_client" INCLUDE_DIR="$BUILD_DIR/curl-wasm/include/" LIB_DIR="$BUILD_DIR/curl-wasm/lib/" @@ -80,7 +80,6 @@ fi #ensure deps are compiled tools/all_deps.sh tools/generate_cert.sh -tools/wisp_client.sh #compile the main c file COMPILE_CMD="emcc $C_DIR/*.c $COMPILER_OPTIONS $EMSCRIPTEN_OPTIONS" @@ -115,7 +114,9 @@ sed -i "/__extra_libraries__/r $JAVSCRIPT_DIR/messages.js" $OUT_FILE sed -i "/__extra_libraries__/r $JAVSCRIPT_DIR/util.js" $OUT_FILE sed -i "/__extra_libraries__/r $JAVSCRIPT_DIR/logger.js" $OUT_FILE -sed -i "/__extra_libraries__/r $WISP_CLIENT/dist/wisp-client.js" $OUT_FILE +sed -i "/__extra_libraries__/r $WISP_CLIENT/polyfill.js" $OUT_FILE +sed -i "/__extra_libraries__/r $WISP_CLIENT/wisp.js" $OUT_FILE + #apply patches python3 tools/patch_js.py $FRAGMENTS_DIR $OUT_FILE diff --git a/client/fragments/wisp_support.js b/client/fragments/wisp_support.js index 5bc7c3f..aad3fcb 100644 --- a/client/fragments/wisp_support.js +++ b/client/fragments/wisp_support.js @@ -3,7 +3,7 @@ ws ?= ?new WebSocketConstructor\(url, ?opts\) */ try { if (api.transport === "wisp") { - ws = new wisp_client.client.WispWebSocket(url); + ws = new WispWebSocket(url); } else if (api.transport === "wsproxy") { ws = new WebSocket(url); diff --git a/client/javascript/main.js b/client/javascript/main.js index c8a0bf0..bcb09b8 100644 --- a/client/javascript/main.js +++ b/client/javascript/main.js @@ -130,9 +130,9 @@ api = { get_error_string: get_error_str, wisp: { - wisp_connections: wisp_client.client._wisp_connections, - WispConnection: wisp_client.client.ClientConnection, - WispWebSocket: wisp_client.client.WispWebSocket + wisp_connections: _wisp_connections, + WispConnection: WispConnection, + WispWebSocket: WispWebSocket }, transport: "wisp", diff --git a/client/tools/wisp_client.sh b/client/tools/wisp_client.sh deleted file mode 100755 index 997d196..0000000 --- a/client/tools/wisp_client.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -#download and extract wisp-js - -set -e - -VERSION="0.3.3" -PREFIX=$(realpath build/wisp-js) -TARBALL_PATH="$(realpath build/wisp-archive.tar.gz)" -TARBALL_URL=$(npm view @mercuryworkshop/wisp-js@$VERSION dist.tarball) - -if [ -d "$PREFIX" ]; then - exit -fi - -rm -rf $PREFIX -mkdir -p $PREFIX -wget $TARBALL_URL -O $TARBALL_PATH -tar xf $TARBALL_PATH -C $PREFIX -rm $TARBALL_PATH \ No newline at end of file diff --git a/client/wisp_client b/client/wisp_client new file mode 160000 index 0000000..6aa58be --- /dev/null +++ b/client/wisp_client @@ -0,0 +1 @@ +Subproject commit 6aa58be0897501ac444b38e7e7c0008da24f79ba