Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何将跟踪元数据从python gRPC服务发送到gRPC web客户端?_Javascript_Python_Envoyproxy_Grpc Web - Fatal编程技术网

Javascript 如何将跟踪元数据从python gRPC服务发送到gRPC web客户端?

Javascript 如何将跟踪元数据从python gRPC服务发送到gRPC web客户端?,javascript,python,envoyproxy,grpc-web,Javascript,Python,Envoyproxy,Grpc Web,我正在尝试将跟踪元数据从python gRPC服务发送到gRPC web客户端。但在客户端,我无法接收它 我正在使用特使代理服务器连接grpc网络和Pyton grpc服务 对于发送元数据,我使用以下方法: class迎宾员(helloworld\u pb2\u grpc.GreeterServicer): def SayHello(自我、请求、上下文): context.set_尾随_元数据(( (“校验和”,“我同意”), ('retry','false'), )) 返回helloworld

我正在尝试将跟踪元数据从python gRPC服务发送到gRPC web客户端。但在客户端,我无法接收它

我正在使用特使代理服务器连接grpc网络和Pyton grpc服务

对于发送元数据,我使用以下方法:

class迎宾员(helloworld\u pb2\u grpc.GreeterServicer):
def SayHello(自我、请求、上下文):
context.set_尾随_元数据((
(“校验和”,“我同意”),
('retry','false'),
))
返回helloworld_pb2.HelloReply(message='Hello,%s!'%request.name)
在客户端上,我尝试通过以下方式访问元数据:

var call=greetreservice.sayHello(请求,{},函数(err,response){
如果(错误){
控制台日志(错误代码);
控制台日志(错误消息);
}否则{
log(response.getMessage());
}
});
call.on('status',函数(status){
console.log(状态代码);
console.log(status.details);
console.log(status.metadata);//这里应该是元数据
});
我将按照文档中的描述发送它。但元数据还没有到达

有人有这样的问题吗?

在调用方法之前,您需要使用相同的medatdata键调用,但不能使用任何值

在我的情况下,它将如下所示:

class迎宾员(helloworld\u pb2\u grpc.GreeterServicer):
def SayHello(自我、请求、上下文):
context.send\u初始\u元数据((
(‘校验和’,“”),
(‘重试’,“”),
))
context.set_尾随_元数据((
(“校验和”,“我同意”),
('retry','false'),
))
返回helloworld_pb2.HelloReply(message='Hello,%s!'%request.name)
事实上,我偶然发现了这个解决方案

我假设您需要在初始元数据中指定头名称,然后才应该在后续元数据中设置头值,然后特使可以正确打包并通过HTTP 1.1交付