docs-01-idl.md 712 B

English version

01 - RPC IDL

  • 描述文件
  • 前后兼容
  • Protobuf/Thrift

示例

下面我们通过一个具体例子来呈现

  • 我们拿pb举例,定义一个ServiceName为Exampleexample.proto文件
  • rpc接口名为Echo,输入参数为EchoRequest,输出参数为EchoResponse
  • EchoRequest包括两个string:messagename
  • EchoResponse包括一个string:message

    syntax="proto2";
    
    message EchoRequest {
    optional string message = 1;
    optional string name = 2;
    };
    
    message EchoResponse {
    optional string message = 1;
    };
    
    service Example {
     rpc Echo(EchoRequest) returns (EchoResponse);
    };