-
Notifications
You must be signed in to change notification settings - Fork 73
gRPC-Web support #35
Comments
Yeah, it sounds roughly sane. I don't know that much about the grpc-web protocol. I also am not entirely sure what the fetch API is in practice. If you want to experiment with something, maybe try a spike in an external repo and we can go from there. |
Just to update this issue, I'm still working on this but am stuck fixing lower-level components such as the compiler support for wasm interacting with webpack. If anybody else is reading this issue, please ping me if you are interested in helping out! |
+1 from me. |
Btw the scope is sane. It's exactly what I do in golang currently. |
Just chiming in that I've thought about doing this asynchronously but that it would be cool to contribute to an existing effort. I've got a pretty good idea of how the gRPC-Web protocol works and how to use the Fetch API with it, but I'm very inexperienced with Rust. Please let me know how I can help! |
I don't think it's worthwhile implementing a wrapper around the Improbable grpc-web client, just write the whole thing in WASM, it's not really a large amount of logic and you can probably copy most of it from the open source client. |
I'm not sure where the talk about WASM is coming from, that's IMO out of scope — we don't need a new grpc-web client-side implementation and if we did it would have little to do with Edit: ok, the original request does talk about both. But I think if a client-side WASM implementation is wanted at all, it should probably be a separate ticket or even a separate project. |
Great, thanks for the clarification. I understand the distinction. In any case @dflemstr, please reach out ( |
@johanbrandhorst I decided to spend my time on other things while waiting for the tower ecosystem to mature a bit before spending more time on this. Maybe now is a good time to continue. What I would like to have is a detailed understanding of how to translate a gRPC-Web request to gRPC and vice versa. Right now there is only the Go reference implementation which is a bit hard to follow (it mutates request objects here and there and has an interesting way of stashing away request trailers etc). Given that we have that, a tower wrapper should be easy to add. I am also interested in a client implementation, that can be compiled to WASM for use client side. This enables a lot of code sharing between server and client which is quite nice. |
a working implementation of gRPC-web in rust would be indeed very useful, but more satisfying support for twirp (= http1.1 protobuf+json fallback for simple browser access) in tower could be even more desirable. |
@mash-graz I think that could be covered under a separate issue. |
@johanbrandhorst done! => #185 |
I have just tested this "unofficial" A WSAM Rust client runing in Browser, connecting to server via HTTP2, exposing API to JS/TS... I'm frustrated, that is a huge project |
As mentioned in hyperium/tonic#31, I've created a sandbox repo to play around with prototyping this: https://github.com/johanbrandhorst/rust-grpc-web-wasm-test. It's currently just a Go gRPC server with the gRPC-Web proxy, the idea is that we can manually try to implement a first pass on a Rust WASM client. See the README for more information. |
I'd like to use
tower
with the gRPC-Web protocol.Some use-cases that I'm thinking about in order of priority:
I'd like to discuss how to do this in a nice way. Here's what I was (maybe naïvely) thinking:
tower-grpc-web
containing astruct GrpcWebService
that wraps anothertower::Service
usinghttp::Request
andhttp::Response
, and transparently changes the encoding on the fly. This can then be used withtower-grpc
generated clients/servers directly.tower
+HTTP/1tower
glue to the WhatWGfetch
APItower::Service
s depending on if the request is HTTP/1 or HTTP/2 and depending on headers likeContent-Type
.Does this sound sane? Are there any existing components I could leverage? Is there a smarter way to do this?
The text was updated successfully, but these errors were encountered: