syntax = "proto3"; package tutorial; option java_package = "com.duowan.allstar.proto"; option java_outer_classname = "MessageProtos"; message Message { enum Type { COMMON = 0; CHAT = 1; DATA = 2; } Type type = 1; message ChatMessage { // 消息 id int64 id = 1; // 用户id int64 uid = 2; // 接收方的 uid int64 receiveUid = 3; // 业务类型 int32 bType = 4; // 内容类型 int32 contentType = 5; // 消息内容 string msg = 6; // 内容长度 int32 contentLen = 7; // 有无权限 int32 hasAuth = 8; // 发送时间 int64 sendTime = 9; int32 isRead = 10; // 发送者 UserInfo sender = 11; } ChatMessage chatMessage = 2; message CommonMessage { string msg = 1; } CommonMessage commonMessage = 3; message DataMessage { int32 code = 1; int32 result = 2; string data = 3; string msg = 4; } DataMessage dataMessage = 4; message UserInfo { int64 uid = 1; string nick = 2; string head = 3; } }