Any GRPC client code example running on browser using j2cl and Bazel? #231
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@seyoung-song-walmart-com Having investigated this before as a user (I'm not a Googler), you will probably Have a Bad Time, unless things have changed recently. I would humbly recommend Buf and their Connect RPC protocol |
Beta Was this translation helpful? Give feedback.
-
I've spent a lot of time over the last few years on this, and the state of affairs is not great. I'm looking to improve things, but I don't have a mandate/funding to aggressively pursue this at this time. My frame of reference here is using Apache Arrow Flight, which is protobuf-over-gRPC, with flatbuffer payloads in some of the protobuf fields, and then some columnar data in another protobuf field to represent the data itself. It was a business requirement to use these tools, so we tried to do as little proxying on top of this as possible (e.g. Buf's "just make everything JSON" or "just make the protobuf binary payload to be base64'd text instead"). Streaming was a requirement (and is purported to be one of the great features that gRPC has), and other platforms were already capable of using gRPC... and gRPC-web's documentation describes it as being a browser-compatible implementation of gRPC. The Good:
That's it I'm afraid, the rest of the news is bad or how to slightly overcome the bad. The Bad:
What worked for us:
Finally, note that we're still using GWT 2, due to to a number of factors, but the specific code mentioned here should all be compatible with J2CL as well. All in all, this gets us all four types of gRPC calls, with binary payloads, and no extra proxies required, working with local development. This has been deployed in production for quite a while - we're hitting bugs in Chrome (kills h2 calls if unrelated network changes happen) and Envoy (ending streams will sometimes throw away DATA and HEADER frames in envoy rather than forward them), but no complaints with keeping our client logic working over gRPC-web with Java. |
Beta Was this translation helpful? Give feedback.
@seyoung-song-walmart-com Having investigated this before as a user (I'm not a Googler), you will probably Have a Bad Time, unless things have changed recently. I would humbly recommend Buf and their Connect RPC protocol