Could any one explain to me the difference between...
# webassembly
s
Could any one explain to me the difference between wasm Js and wasm Wasi
e
wasmJs is loaded in a JS host, https://webassembly.org/getting-started/js-api/ (e.g. no main, JS calls into it, WASM can call out to JS) wasmWasi is designed to run outside of a JS host, https://wasi.dev/ (entry point inside WASM, with a set of "syscalls" available instead)
thank you color 2
h
@ephemient correct me if I'm wrong, but if I understood correctly, wasi is like how WASM should actually be?
e
what do you mean by that? WASM was designed for web first
h
Wasi is the web assembly API correct? And wasmjs relies on the JS api?
e
no. WASI is "WebAssembly System Interface", which is a specific set of interfaces (which could be implemented by a JS host, but are designed for system integration)
h
Thank you for the clarification, I was very confused regarding this
m
So, WASM Js is distributed like a web page. You host it on some server. There is an URL to it and the clients run it via their browser. But how does the distribution of a WASM/WASI app work? What are the differences/advantages compared to a JVM desktop app?
e
kotlin wasm js can be distributed similar to the existing kotlin js: either for browser, or for non-browser (nodejs or d8)
s
WASI provides your app with CLI arguments, environment variables, time, file I/O, network access, a clock, and RNG. This is enough for some servers and CLI apps, but not yet for desktop. When compiled, you’ll get a
.wasm
file. You can then run or distribute it in the way you prefer. You would be able to run it in any Wasm VM of your choice. I could imagine cloud providers accepting
.wasm
files directly as an alternative to Docker images
m
So what is my best bet then when I want to have something that behaves like a desktop app but is as easily distributed and updated as a web page? I’ll need the WASI functionality but “You can then run or distribute it in the way you prefer. You would be able to run it in any Wasm VM of your choice.” just brings me back to the situation with unbundled Java applications where the user first has to install some VM before he/she can run anything or am I missing something here? Will browsers support WASI too in the future?
s
To my understanding, Wasm is browsers will have just as much capabilities as JavaScript, but will allow other languages, like Kotlin, to be more efficient there. And you could use WASI APIs but they will be limited to what JS can do. WASI is currently at the very early stage, but it looks like a promising foundation. If you need something graphical short-term (2-3 years), I’d bet on browsers and things build around them, like electron. Or, alternatively, some existing non-Wasm tech.
🙏 1
@Michael Paus I recently came across a page that might interest you: https://developer.chrome.com/docs/capabilities/status
Web apps should be able to do anything iOS, Android, or desktop apps can. […]
🙏 1
m
@Svyatoslav Kuzmich [JB] This is indeed a very interesting reading and covers exactly what I was thinking about.
176 Views