Search code examples
gogrpcwebassemblygrpc-gogrpc-web

Go WebAssembly with gRPC Web


I want to make a website using webassembly written mainly in go, and I would like to use grpc protocol, due the web restrictions, I have to use the "web version protocol" of grpc, and it can be compiled to js library, and how can I compile the "web version" in go? I found this useful to compile: https://github.com/namely/docker-protoc


Solution

  • Interesting question but I think (!?) you can't yet do this.

    There are >2 issues:

    1. WASM in the browser is currently unable (!?) to access Web APIs.
    2. The only gRPC-Web SDK is JavaScript (and, since WASM in the browser can't access Web APIs, even if you wrote one in Golang, when you compiled apps using it to WASM, the wouldn't work in the browser)