Re: How to use a Rust/Wasi based API with a WasmerJS web app.

19 views
Skip to first unread message
Message has been deleted

Sam Clegg

unread,
Jan 13, 2021, 11:43:32 AM1/13/21
to emscripte...@googlegroups.com
This doesn't look like an emscripten question.. wrong list maybe?

On Wed, Jan 13, 2021 at 6:37 AM Tim Co <shardl...@gmail.com> wrote:
I have the Rust/Wasi HQ9+ example running in a WasmerJS Svelte app and can access the same wasmFS filesystem with both. All good so far.

What I want to do now is be able to expose APIs from Rust to the app JavaScript and vice versa. I've been trying to do this with wasm-bindgen, and did manage to expose a function in the wasi `instance.exports` in addition to the Rust `main()` but my changes also cause an error, and I don't know how to call the function anyway. I was trying to combine the WasmerJS style with the wasm-bindgen style described in this article (https://hacks.mozilla.org/2018/04/javascript-to-rust-and-back-again-a-wasm-bindgen-tale/) but I don't know what I'm doing.

Does anyone know how to go about this or have a WasmerJS example which does more than call the `main()` of a WASI backend? It doesn't have to be Rust, although that would be best obvs.

I'd also like to be able to make calls from the Rust back to the JS app.

Oh, my working WasmerJS Rust example code is at: https://github.com/happybeing/svelte-wasi-with-rust

Also, I have a github issue for this if anyone prefers to comment there: https://github.com/wasmerio/wasmer-js/issues/250#issuecomment-758764887

Thanks.

--
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/aefbec4f-4e27-4807-ba13-445365c8cb17n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages