wasm: use port 7080, use kanaka/rust-wasm image

This commit is contained in:
Joel Martin 2018-07-31 11:02:37 -05:00
parent 5372d169cc
commit 876a691d2a
3 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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)
}

View File

@ -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",