【问题标题】:How to call grpc-web proxy from a NodeJS server如何从 NodeJS 服务器调用 grpc-web 代理
【发布时间】:2019-11-27 17:24:03
【问题描述】:

我正在运行实现服务接口的 gRPC 服务器和允许客户端连接的 Envoy 代理,以下 js 代码(文件 health.js)使用 webpack 构建并在 HTML 文件中引用 dist/main.js 进行成功调用和这是工作

const { HealthCheckRequest, HealthCheckReply } = require("./protobuf/service_pb")
const { ProtoClient } = require("./protobuf/service_grpc_web_pb")
var client = new ProtoClient('http://localhost:8080');

var request = new HealthCheckRequest()
client.healthCheck(request, {}, (err, response) => {
    console.log(response)
})

我想在NodeJS服务器而不是浏览器中执行这个功能,实际上执行命令node health.js出现以下错误

...
ReferenceError: XMLHttpRequest is not defined
...

【问题讨论】:

    标签: envoyproxy grpc-web


    【解决方案1】:

    目前不支持此功能。您可以通过我们的存储库在https://github.com/grpc/grpc-node

    创建一个功能请求

    由于它实际上是不同的协议,因此需要编写新代码来支持它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-02
      • 1970-01-01
      • 2019-07-23
      • 1970-01-01
      • 2018-07-28
      相关资源
      最近更新 更多