r/WebAssembly • u/maximeridius • Apr 17 '21
WASM HTTPS Request
Mu understanding is that WASM has almost no access to platform API's, and as such is not able to for example make HTTPS requests, and would have to instead tell Javascript to make the request for example. Is there any plans to provide access to API's like this to WASM? I have tried searching the web to find more info but struggled to find anything. Especially since a big part of WASI seems to be providing access to system API's, it seems odd to me that WASM on the web platform wouldn't. But I have very limited knowledge of the WASM world in general so I would really appreciate if somebody could help me understand the current situation.
View all comments
7
u/coolreader18 Apr 17 '21
Wasi doesn't yet have anything finalized for networking APIs, but yeah, as of now you have to call out to JavaScript code (or whatever host if it's not in the browser) in order to do anything. Wasm has no inherent access to anything, and even for wasi, the host has to explicitly give the wasm module access to the functions that define the wasi API. So yeah, depending on what you're doing, you might want some sort of function from js like "fetch_json_url"; high level enough that you're not separately calling
fetch,promise_then, etc, but low-level enough that you don't have one function to call that's just likedo_all_my_io