27 lines
866 B
Protocol Buffer
27 lines
866 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
package example;
|
|
|
|
option go_package = "example.com/grpc-service-generator/examples";
|
|
|
|
// The service definition.
|
|
service StreamingService {
|
|
// Sends a greeting
|
|
rpc ClientStreamingExample (stream ClientStreamingRequest) returns (ClientStreamingResponse) {}
|
|
}
|
|
|
|
// The request message containing the user's name.
|
|
message ClientStreamingRequest {
|
|
string message = 1; // The message from the client. Can represent chunks of data.
|
|
}
|
|
|
|
// The response message containing the greetings
|
|
message ClientStreamingResponse {
|
|
string result = 1; // The aggregated result based on the client's stream.
|
|
}
|
|
|
|
// Instructions:
|
|
// 1. Define your request and response messages
|
|
// 2. Define the RPC service, using the stream keyword for streaming RPCs
|
|
// 3. Implement the server and client code
|
|
// 4. Remember to handle errors and closing the stream gracefully. |