syntax = "proto3"; package example; option go_package = "example.com/grpc-service-generator/examples"; // Define the service service StreamingService { // Server-side streaming RPC. The client sends a single request, and the // server responds with a stream of messages. rpc ServerStreamingExample (StreamingRequest) returns (stream StreamingResponse) {} } // The request message for the ServerStreamingExample RPC. message StreamingRequest { string request_id = 1; // A unique identifier for the request. int32 num_responses = 2; // The number of responses the server should send. string message_prefix = 3; // A prefix to add to each response message. } // The response message for the ServerStreamingExample RPC. message StreamingResponse { string response_id = 1; // A unique identifier for the response. string message = 2; // The message content. } // Example usage notes: // // - The `request_id` field in `StreamingRequest` can be used for logging and // correlation. // - The `num_responses` field allows the client to control the number of // messages received. Consider adding a maximum limit to prevent resource exhaustion. // - The `message_prefix` field demonstrates how to parameterize the server's // response. This could be used to customize the response based on user preferences. // - The `response_id` field in `StreamingResponse` allows for identifying individual messages in the stream. // - Consider adding error handling to the server implementation to gracefully // handle situations where the client disconnects prematurely. // - For production, consider adding authentication and authorization to the service.