Closed douglaswaights closed 2 years ago
is this something that is expected to work
Unfortunately not at this stage, at least not on a bare-metal WASI runtime.
The WASI spec itself doesn't yet contain any outbound networking, so you can't have a gRPC client or even an HTTP client (whereas you can have a gRPC server or an HTTP server).
Everyone in the WASI community is keenly aware of how important and urgent it is to fix these massive gaps and is working towards that. Hopefully the WebAssembly Component Model spec, when ratified, will make it possible to move far faster with expanding the scope of what WASI can do.
In the meantime it's technically possible to implement your own WASI host environment that adds custom native functionality so you could implement your own custom outbound networking. That's how all the FaaS-on-Wasm services work today. But it's nontrivial to implement and involves having deep understanding of the whole stack.
I was also wondering more generally about using C# wasm in a more faas orientated / plugin style. I would like to build a C# wasm module that exposes functions i somehow declare in C# and then can call via wasmtime embedded in another host application. Is this possible?
Yes, for example see how the https://github.com/SteveSandersonMS/dotnet-wasi-sdk/tree/main/src/Wasi.AspNetCore.Server.CustomHost sample exposes custom imports/exports for the wasm code and calls it from a custom host. It's pretty difficult and low-level at the moment, but https://github.com/SteveSandersonMS/dotnet-wasi-sdk/issues/30 should be the solution to make this friendly and only require writing familiar C# code.
@SteveSandersonMS Thanks very much for the comprehensive reply. This makes sense!
Hi,
I'm using .net 7 preview 6 and wasmtime-cli 0.40.0. using wasi sdk 0.1.1
If i try and create a grpc channel with the following code in program.cs
I realise this is all highly experimental but is this something that is expected to work? I guess not right now. I had high hopes after seeing the Greenhouse Monitor demo :-) although i appreciate that was a server rather than client.
I was also wondering more generally about using C# wasm in a more faas orientated / plugin style. I would like to build a C# wasm module that exposes functions i somehow declare in C# and then can call via wasmtime embedded in another host application. Is this possible?
Regards Doug