Where/how to host

29 views
Skip to first unread message

Sam Hobbs

unread,
Sep 8, 2022, 1:34:02 AM9/8/22
to emscripten-discuss
Where can a website created using emscripten be hosted? How? Would most any host work; would it be like a plain HTML website?

I realize that if I learn more about emscripten then I will likely be able to answer my question myself. I am just not sure I want to spend time learning it. I am excited about using C++ for websites. I am however tired of learning things and then wasting my time on something impractical for me. I have tried to search for answers to my question and I did not find answers. I hope the question is a reasonable question.

Gregory Propf

unread,
Sep 8, 2022, 4:08:10 AM9/8/22
to emscripte...@googlegroups.com
Well, emscripten is just a way to compile C++ to webasm or JavaScript. Both of those run in the browser so the hosting provider really just hosts the JS, WASM, and HTML files. I suppose you could write a server-side app in C++ and compile to webasm or JS to run with one of the NodeJS server frameworks too but in general anything running a webserver should work as a server. - Greg

On Wed, Sep 7, 2022 at 10:34 PM Sam Hobbs <soca...@gmail.com> wrote:
Where can a website created using emscripten be hosted? How? Would most any host work; would it be like a plain HTML website?

I realize that if I learn more about emscripten then I will likely be able to answer my question myself. I am just not sure I want to spend time learning it. I am excited about using C++ for websites. I am however tired of learning things and then wasting my time on something impractical for me. I have tried to search for answers to my question and I did not find answers. I hope the question is a reasonable question.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/1061df54-d0fb-4d5d-976c-cdb24cfbd6b2n%40googlegroups.com.

Floh

unread,
Sep 8, 2022, 4:15:27 AM9/8/22
to emscripten-discuss
Yes, you can web-host like a regular static webpage. The Emscripten compiler usually outputs three files: one .html, one .js and one .wasm. The .html file is basically your index.html which is loaded when visiting the URL. The .js and .wasm files are then loaded by the .html file, the only rule is that the .js and .wasm file must be in the same web server directory as the .html file.

I'm just host my WASM stuff on GH Pages, for instance:


The visual6502remix page hosting directory looks like this (just the output of emcc, with the .html file renamed to index.html):

Be aware though that hosting on Github Pages means that some WASM features like multi-threading (or rather SharedArrayBuffer) are disabled, because the GH Pages web server can't be reconfigured to return the required response headers (there's a workaround with service workers which I haven't tried yet). Other web hosters allow this sort of configuration, so the choice of web hoster dictates what sort of WASM features you can use (which IMHO is a massive design wart, but whatever...)

Cheers!

Gregory Propf

unread,
Sep 8, 2022, 1:35:18 PM9/8/22
to emscripte...@googlegroups.com
Love your pages Andre. I even played a bit of Doom! They reminded me of when I was writing 6502 assembly for games on my Apple II as a kid. I wasn't aware of the header issue in github as I use my own server but I suppose this is something I'll need to configure eventually. One of the things I've been meaning to try out is the threading support in emscripten. I've been working on a small web framework library project in C++ lately but I haven't yet seen a need for threads. I'm getting to the part where I'm looking at the Canvas and SVG objects though and I can see how the animation part could benefit from threads. - Greg

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages