Streaming data from the client
Another type of call that gRPC supports is the client-streaming call. With this call, a client can send a stream of messages while the server still returns only a single message as the response.
For the remainder of this chapter, we will only be using client and server implementations of the device_management.proto
file. The other Protobuf files are now redundant as they have already served their purpose to demonstrate how gRPC middleware resolves the URL path and how it deals with conflicts.
Adding a client-streaming call to the server application
We will start by adding a new client-streaming rpc
to the service definition inside a Protobuf definition. Then, we will implement this rpc
as a C# method in the gRPC service application:
- Add the following
rpc
to theDeviceManager
service definition inside thedevice_management.proto
file, which is located in theGrpcDependencies
project:rpc UpsertDeviceStatuses (stream DeviceDetails) returns...