//bytes替代string 防止乱码 syntax = "proto3"; package stream; //ption cc_generic_services = true; option java_multiple_files = true; option java_package = "io.grpc.examples.stream"; option java_outer_classname = "StreamProto"; option objc_class_prefix = "ST"; message RequestInfo { uint32 dataType = 1; //信息类型 bytes nameKey = 2; //参数key bytes strValue = 3; //value enum TYPE{ iBOOL = 0; iSHORT = 1; iUSHORT = 2; iINT = 3; iUINT = 4; iFLOAT = 5; iSTRING = 6; } TYPE valueType = 4; } message ResponseInfo { uint32 dataType = 1; //信息类型 bool result = 2; bytes nameKey = 3; //参数key bytes strValue = 4; //value enum TYPE{ iBOOL = 0; iSHORT = 1; iUSHORT = 2; iINT = 3; iUINT = 4; iFLOAT = 5; iSTRING = 6; } TYPE valueType = 5; //数据类型 } service Stream { rpc Simple(RequestInfo) returns (ResponseInfo) {} // 简单模式 rpc ServerStream (RequestInfo) returns (stream ResponseInfo) {} // 服务端数据流模式 rpc ClientStream (stream RequestInfo) returns (ResponseInfo) {} // 客户端数据流模式 rpc AllStream (stream RequestInfo) returns (stream ResponseInfo) {} // 双向数据流模式 }