Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

How best to deploy a WebAssembly app



  • Let's say I can't host a server on my own machine that people can connect to.

    Could I instead deploy a WebAssembly app to another machine by sharing files?
    That is you copy the files to machine M:

    app.html	HTML container
    qtloader.js	JS API for loading Qt apps
    app.js	        JS API for loading Qt apps
    app.wasm    	emscripten app binary
    

    Then start up a local server on machine M with:

    python3 -m http.server
    

    But why does that not work? Does the server need emrun installed?
    With a simple Qt helloworld, I get the error message:

    TypeError: NetworkError when attempting to fetch resource.
    

  • Lifetime Qt Champion

    Hi,

    You need a server that is configured to serve these 4 files. A small nginx should be enough.



  • @SGaist said in How best to deploy a WebAssembly app:

    nginx

    Thank you!...Am a complete beginner. Just the help I needed! I'll try out nginx or something akin. :)


Log in to reply