summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2018-07-31 11:02:37 -0500
committerJoel Martin <github@martintribe.org>2018-07-31 11:02:37 -0500
commit876a691d2a376a2eda810a27097727ac35d910e5 (patch)
tree43f49fc66dfc790137939c5954f6daf89fe77753
parent5372d169ccf9dc0b4d2311ea4d7a1b8ab7b42af4 (diff)
downloadnovnc-wasm.tar.gz
wasm: use port 7080, use kanaka/rust-wasm imagewasm
-rw-r--r--core/wasm/README.md10
-rw-r--r--core/wasm/index.js6
-rw-r--r--core/wasm/package.json3
3 files changed, 12 insertions, 7 deletions
diff --git a/core/wasm/README.md b/core/wasm/README.md
index d0c26c1..6f40d63 100644
--- a/core/wasm/README.md
+++ b/core/wasm/README.md
@@ -13,18 +13,22 @@ It is based on information from the following sources:
## Prep:
```
-docker build -t rust-wasm ./core/wasm
+docker build -t kanaka/rust-wasm ./core/wasm
+ # OR
+docker pull kanaka/rust-wasm
-docker run -it -v `pwd`:/novnc -w /novnc/core/wasm -p 8080:8080 rust-wasm bash
+docker run -it -v `pwd`:/novnc -w /novnc/core/wasm -p 7080:7080 kanaka/rust-wasm bash
npm install
```
## Build:
+Run the following inside the container:
+
```
npm run build-release # or run build-debug (10x slower code)
-npm run serve # then visit localhost:8080 outside the container
+npm run serve # then visit localhost:7080 outside the container
```
Note that `run server` will automatically detect modification to
diff --git a/core/wasm/index.js b/core/wasm/index.js
index 7570b96..39ece56 100644
--- a/core/wasm/index.js
+++ b/core/wasm/index.js
@@ -19,15 +19,17 @@ let imgData = new ImageData(u8array, WIDTH, HEIGHT)
let frame = -1
function renderLoop() {
- //const startMs = (new Date()).getTime()
fps.render()
frame += 1
+ //const tms1 = (new Date()).getTime()
novnc.draw(pointer, WIDTH, HEIGHT, frame)
+ //const tms2 = (new Date()).getTime()
ctx.putImageData(imgData, 0, 0)
+ //const tms3 = (new Date()).getTime()
+ //console.log("elapsed 1:", tms2 - tms1, "elapsed 2:", tms3 - tms2)
animationId = requestAnimationFrame(renderLoop)
- //console.log("elapsed:", (new Date()).getTime() - startMs)
}
diff --git a/core/wasm/package.json b/core/wasm/package.json
index 996d4be..0399217 100644
--- a/core/wasm/package.json
+++ b/core/wasm/package.json
@@ -1,10 +1,9 @@
{
"scripts": {
- "serve": "webpack-dev-server --host 0.0.0.0",
+ "serve": "webpack-dev-server --host 0.0.0.0 --port 7080",
"build-debug": "cargo +nightly build --target wasm32-unknown-unknown && wasm-bindgen target/wasm32-unknown-unknown/debug/novnc.wasm --out-dir .",
"build-release": "cargo +nightly build --release --target wasm32-unknown-unknown && wasm-bindgen target/wasm32-unknown-unknown/release/novnc.wasm --out-dir .",
"bundle": "npm run build-release && webpack"
-
},
"devDependencies": {
"webpack": "^4.16.2",