我想知道是否可以定义一个不返回任何内容的 RPC,即服务器是否可以只使用传入的客户端消息而不返回任何响应?
是的,可以。
您可以定义一个返回 google.protobuf.Empty
类型消息的服务,然后从客户端异步调用该服务。正如@uli的评论中所述,您仍然需要向客户端发送complete()
,但您可以先做一件事,然后执行剩余的处理。