小编And*_*nto的帖子

gprc 客户端异步响应 NodeJS

我试图在函数中调用一个简单的 grpc 请求,但我不知道如何等待响应并将其传递到 grpc 调用之外。

应该是这样的:

Client: (parent, args, context, info) =>{
      client.Get({thing, objects, properties}, function(err, response) {
            //how to return the response outside?
          });
      //await for the response function.
};
Run Code Online (Sandbox Code Playgroud)

是否可以在 client.Get 函数之外以某种方式返回响应?有人有一些建议吗?谢谢您的建议!

rpc node.js async-await grpc graphql

0
推荐指数
1
解决办法
5823
查看次数

标签 统计

async-await ×1

graphql ×1

grpc ×1

node.js ×1

rpc ×1