使用其他消息类型

我们可以将其他消息类型用作字段类型。例如我们ServiceResponse消息中包含Result消息,此时可以在相同的.proto文件中定义一个Result消息类型,然后在ServiceResponse消息中指定一个Result类型的字段,如:

  1. message ServiceResponse {
  2. repeated Result results = 1;
  3. }
  4. message Result {
  5. string name = 1;
  6. string streamKey = 2;
  7. repeated string publishURL = 3;
  8. }