# HG changeset patch # User am@osimis.io # Date 1534862161 -7200 # Node ID 6b98ac45aaeea2d8fbb26a54d346e9a0be7dede9 # Parent 77fdab5b5d6e95a7009606f1464cb2da7bd8d9ef documented how to compile and execute WASM samples diff -r 77fdab5b5d6e -r 6b98ac45aaee Applications/Samples/Web/index.html --- a/Applications/Samples/Web/index.html Tue Jul 17 18:28:12 2018 +0200 +++ b/Applications/Samples/Web/index.html Tue Aug 21 16:36:01 2018 +0200 @@ -14,7 +14,7 @@ diff -r 77fdab5b5d6e -r 6b98ac45aaee Applications/Samples/Web/simple-viewer.ts --- a/Applications/Samples/Web/simple-viewer.ts Tue Jul 17 18:28:12 2018 +0200 +++ b/Applications/Samples/Web/simple-viewer.ts Tue Aug 21 16:36:01 2018 +0200 @@ -1,3 +1,3 @@ /// -InitializeWasmApplication("OrthancStoneSimpleViewer", "../../../stone-orthanc"); +InitializeWasmApplication("OrthancStoneSimpleViewer", "/orthanc"); diff -r 77fdab5b5d6e -r 6b98ac45aaee Platforms/Wasm/nginx.local.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Platforms/Wasm/nginx.local.conf Tue Aug 21 16:36:01 2018 +0200 @@ -0,0 +1,44 @@ +# Local config to serve the WASM samples static files and reverse proxy Orthanc. +# Uses port 9977 instead of 80. + +# `events` section is mandatory +events { + worker_connections 1024; # Default: 1024 +} + +http { + + # prevent nginx sync issues on OSX + proxy_buffering off; + + server { + listen 9977 default_server; + client_max_body_size 4G; + + # location may have to be adjusted depending on your OS and nginx install + include /etc/nginx/mime.types; + # if not in your system mime.types, add this line to support WASM: + # types { + # application/wasm wasm; + # } + + # serve WASM static files + root build-web/; + location / { + } + + # reverse proxy orthanc + location /orthanc/ { + rewrite /orthanc(.*) $1 break; + proxy_pass http://127.0.0.1:8042; + proxy_set_header Host $http_host; + proxy_set_header my-auth-header good-token; + proxy_request_buffering off; + proxy_max_temp_file_size 0; + client_max_body_size 0; + } + + + } + +} diff -r 77fdab5b5d6e -r 6b98ac45aaee README --- a/README Tue Jul 17 18:28:12 2018 +0200 +++ b/README Tue Aug 21 16:36:01 2018 +0200 @@ -87,7 +87,24 @@ http://book.orthanc-server.com/developers/stone.html Stone of Orthanc comes with several sample applications in the -"Samples" folder. These samples use SDL. +"Samples" folder. These samples can be compiled into Web Assembly +or into native SDL applications. + +to build the WASM samples: +``` +cd ~/orthanc-stone/Platforms/Wasm +./build-wasm.sh +``` + +to serve the WASM samples: +``` +# launch an Orthanc listening on 8042 port: +Orthanc + +# launch an nginx that will serve the WASM static files and reverse proxy Orthanc +sudo nginx -p $(pwd) -c nginx.local.conf +``` +Now, you can open the samples in http://localhost:9977 Licensing