grpcWeb is a different protocol to grpc over HTTP/2. At some point we should add support for this.
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md#protocol-differences-vs-grpc-over-http2
I want to be able to consume gRPC services from Blazor. You can read The state of gRPC in the browser. It is pretty easy to set up a gRPC-web proxy for a gRPC service, so it would be nice to be able to servce gRPC-web, but we can get by without out. What we really need is the gRPC-web client.
It would involve writing a custom CallInvoker, similar to the WIP managed .NET client.
There is nothing stopping someone writing one today in .NET Core 2.2. gRPC-web uses HTTP/1 tech which is fully supported by HttpClient.
I vote for this feature.
We intend to do a simple protobuf-over-websocket thing in our blazor app. I'm insisting we call it GhettoRPC. It's relatively easy because we don't absolutely need advanced gRPC features. But it is rather silly, and we'd prefer grpcWeb.
Would love support for this as well. I came up with a grpc-gateway-like solution where I convert calls so I could reach my api via Blazor WASM.
For anyone interested here is my project: https://github.com/razfriman/BlazorGrpc
Server in-process proxy guidance: https://github.com/grpc/grpc-web/blob/master/IN-PROCESS-PROXY.md
For anyone looking to get a working gRPC server & client Blazor wasm app, I've created a simple proof of concept. The PoC uses a gRPC-web proxy hosted in a aspnet core service (KnowitSolutions created the gRPC-web proxy), and consumes it in the blazor wasm app using a basic CallInvoker (created by SteveSandersonMS).
The example does use grpc code first libraries, but is pretty easy to convert to the contract first setup. From the top of my head;
protobuf-net.Grpc.AspNetCore nuget ref with the MS gRPC nuget refAddCodeFirstGrpc with AddGrpc in Startup.csnew your client with the GrpcWebCallInvoker instead of using the ClientFactory
Most helpful comment
It would involve writing a custom
CallInvoker, similar to the WIP managed .NET client.There is nothing stopping someone writing one today in .NET Core 2.2. gRPC-web uses HTTP/1 tech which is fully supported by HttpClient.