简体   繁体   English

gRPC:使用 C++ 从服务器推送通知

[英]gRPC: Push notification from server using C++

Based on this website https://grpc.io/docs/what-is-grpc/core-concepts/ , there are 4 modes of gRPC.基于这个网站https://grpc.io/docs/what-is-grpc/core-concepts/ ,gRPC 有 4 种模式。 May I know which is the most suitable mode for us to push notifications from server in gRPC using C++?我可以知道哪种模式最适合我们使用 C++ 从 gRPC 中的服务器推送通知吗?

4 "modes" is a bit of a misnomer. 4“模式”有点用词不当。 Think of it more as each of the channels, client->server and server->client, being in one of two modes: unary or streaming.更多地把它想象成每个通道,客户端->服务器和服务器->客户端,处于两种模式之一:一元或流。

If the client sends one and exactly one message to the server, then the client->server channel is unary, streaming otherwise.如果客户端向服务器发送一条且恰好一条消息,则客户端->服务器通道是一元的,否则为流式传输。 The same logic applies to the server->client channel.相同的逻辑适用于服务器-> 客户端通道。

Whichever one you should use for "push notifications" depends on the same thing as for any other RPC: How many messages does each peer get to send as part of a single RPC.无论您应该将哪个用于“推送通知”,都取决于与任何其他 RPC 相同的事情:作为单个 RPC 的一部分,每个对等点可以发送多少消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM