简体   繁体   English

Java 中的 Grpc-Web 客户端

[英]Grpc-Web Client in Java

I'm trying to connect to a grpc-service from a Java client.我正在尝试从 Java 客户端连接到 grpc 服务。 The problem is that this service is currently supporting only grpc-web over http1.1, this is because of a limitation of supporting http2 in Azure App service where the service is deployed.问题是该服务目前仅支持通过 http1.1 的 grpc-web,这是因为在部署该服务的 Azure App 服务中支持 http2 存在限制。 The grpc-java client liberary from io.grpc only supports grpc over http2 protocol, which maskes sense, and unfortenatly is not working for me. io.grpc 中的 grpc-java 客户端库仅支持基于 http2 协议的 grpc,这掩盖了意义,不幸的是,它对我不起作用。

I managed to consume a service using HTTP client from apache and okhttp3 but this works for unary calls and it didn't work for a server-side streaming service.我设法使用来自 apache 和 okhttp3 的 HTTP 客户端使用服务,但这适用于一元调用,但不适用于服务器端流媒体服务。

Is any one aware of a grpc-web java client liberary that I could use or a work arround using convenienal Http for reading grpc-web server-side streaming service.是否有人知道我可以使用的 grpc-web java 客户端库或使用方便的 Http 读取 grpc-web 服务器端流媒体服务的工作。

If I understand your question correctly, you want a Java client for gRPC-Web so that your client can talk HTTP/1.1 through a gRPC-Web proxy (eg Envoy gRPC-Web ) because you're unable to talk HTTP/2 directly to your service because of the Azure networking limitation?如果我正确理解您的问题,您需要一个用于 gRPC-Web 的 Java 客户端,以便您的客户端可以通过 gRPC-Web 代理(例如Envoy gRPC-Web )与 HTTP/1.1 对话,因为您无法直接与 HTTP/2 对话由于 Azure 网络限制,您的服务?

In theory this should be possible.理论上这应该是可能的。 The JavaScript implementation is because, in-browser, there's no alternative except JSON transcoding. JavaScript 实现是因为在浏览器中,除了 JSON 转码之外别无选择。 The JavaScript implementation does implement server-side streaming, which is another requirement and confirms that this should be possible over HTTP/1.1. JavaScript 实现确实实现了服务器端流式传输,这是另一个要求,并确认这应该可以通过 HTTP/1.1 实现。

However, in a quick search I found no other (ie non-JavaScript) client implementations of gRPC-Web.然而,在快速搜索中,我没有发现 gRPC-Web 的其他(即非 JavaScript)客户端实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM