https://kotlinlang.org logo
#webassembly
Title
# webassembly
s

soufianehamama9

12/02/2023, 12:58 PM
Could any one explain to me the difference between wasm Js and wasm Wasi
e

ephemient

12/02/2023, 1:57 PM
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

Hristijan

12/02/2023, 10:44 PM
@ephemient correct me if I'm wrong, but if I understood correctly, wasi is like how WASM should actually be?
e

ephemient

12/03/2023, 2:15 AM
what do you mean by that? WASM was designed for web first
h

Hristijan

12/03/2023, 7:13 AM
Wasi is the web assembly API correct? And wasmjs relies on the JS api?
e

ephemient

12/03/2023, 7:15 AM
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

Hristijan

12/03/2023, 7:17 AM
Thank you for the clarification, I was very confused regarding this
m

Michael Paus

12/03/2023, 10:08 AM
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

ephemient

12/03/2023, 10:11 AM
kotlin wasm js can be distributed similar to the existing kotlin js: either for browser, or for non-browser (nodejs or d8)
s

Svyatoslav Kuzmich [JB]

12/03/2023, 11:16 PM
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

Michael Paus

12/04/2023, 9:06 AM
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

Svyatoslav Kuzmich [JB]

12/05/2023, 3:55 PM
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

Michael Paus

12/08/2023, 1:52 PM
@Svyatoslav Kuzmich [JB] This is indeed a very interesting reading and covers exactly what I was thinking about.
24 Views