gRPC Python 服务器调用客户端?
gRPC Python Server calling Client?
我想我了解gRPC 中的客户端-服务器结构,但不知道如何让服务器调用客户端的RPC。
我是否在两侧都实现了客户端和服务器(图为服务器和存根)并且之后有 2 个单独的通道,还是我错过了某个功能?
没有。服务器无法调用客户端上的调用。这是我在 SO 上发现的一个问题的引述:
gRPC works with HTTP, and HTTP has not had such semantics in the past.
There has been discussion as to various ways to achieve such a feature, but I'm unaware of any work having started or general agreement on a design. gRPC does support bidirectional streaming, which may get you some of what you need. With bidirectional streaming the client can respond to messages from server, but the client still calls the server and only one type of message can be sent for that call.
我想我了解gRPC 中的客户端-服务器结构,但不知道如何让服务器调用客户端的RPC。 我是否在两侧都实现了客户端和服务器(图为服务器和存根)并且之后有 2 个单独的通道,还是我错过了某个功能?
没有。服务器无法调用客户端上的调用。这是我在 SO 上发现的一个问题的引述:
gRPC works with HTTP, and HTTP has not had such semantics in the past.
There has been discussion as to various ways to achieve such a feature, but I'm unaware of any work having started or general agreement on a design. gRPC does support bidirectional streaming, which may get you some of what you need. With bidirectional streaming the client can respond to messages from server, but the client still calls the server and only one type of message can be sent for that call.