userCenter.proto 2.62 KB
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
syntax = "proto3";
package userCenter;

option go_package = "protocol/userCenter";

/* id = 1 */
message RouteMessage {
  uint64 uid = 1;
  uint32 msgType = 2;
  bytes payLoad = 3;
}

/* id = 2 */
message RouteMessageRsp {
  uint32 status = 1;
}

/* id = 3 */
message LoginMessage {
  string proxyAddr = 1; // userProxy的地址:ip:port
  string token = 2;
  string clientAddr = 3; // 客户端地址(websocket):ip:port
}

/* id = 4 */
message LoginMessageRsp {
  uint32 status = 1;
  uint64 uid = 2;
}

/* id = 5 */
message LogoutMessage {
  string clientAddr = 1; // 客户端地址(websocket):ip:port
  uint64 uid = 2;
}

/* id = 6 */
message LogoutMessageRsp {
  uint32 status = 1;
}

/* id = 7 */
message MulticastMessage {
  repeated uint64 uids = 1;
  uint32 msgType = 2;
  bytes payLoad = 3;
}

/* id = 8 */
message MulticastMessageRsp {
  repeated uint64 failedUids = 1;
}

/* id = 9 */
message KickMessage {
  uint64 uid = 1;
  string addr = 2;
}

/* id = 10 */
message KickMessageRsp {
  uint32 status = 1;
}

/* id = 11 */
message BroadcastMessage {
  uint32 msgType = 2;
  bytes payLoad = 3;
}

/* id = 12 */
message BroadcastMessageRsp {
  repeated uint64 failedUids = 1;
}

/* id = 13 */
message BizMessage {
  uint64 uid = 1;
  uint32 msgType = 2;
  string payLoad = 3;
}

/* id = 14 */
message BizMessageRsp {
  uint32 status = 1;
}

hujiebin's avatar
hujiebin committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
message EnterRoomMessage {
  uint64 uid = 1;
  string groupId = 2;
}

message EnterRoomMessageRsp {
  uint32 status = 1;
}

message LeaveRoomMessage {
  uint64 uid = 1;
  string groupId = 2;
}

message LeaveRoomMessageRsp {
  uint32 status = 1;
}

message RoomHeartbeatMessage {
  uint64 uid = 1;
  string groupId = 2;
}

message RoomHeartbeatMessageRsp {
  uint32 status = 1;
}

115 116 117 118 119 120 121 122 123 124
// 获取房间内最后一次心跳
message GetLastRoomHeartbeatMessage {
  uint64 uid = 1;
  string groupId = 2;
}

message GetLastRoomHeartbeatMessageResp {
  int64 timestamp = 1;
}

hujiebin's avatar
hujiebin committed
125 126 127 128 129 130 131 132 133 134 135
service Router {
  rpc route(RouteMessage) returns (RouteMessageRsp) {}
  rpc kickUser(KickMessage) returns (KickMessageRsp) {}
}

service User {
  rpc login(LoginMessage) returns (LoginMessageRsp) {}
  rpc logout(LogoutMessage) returns (LogoutMessageRsp) {}
  rpc multicast(MulticastMessage) returns (MulticastMessageRsp) {}
  rpc broadcast(BroadcastMessage) returns (BroadcastMessageRsp) {}
  rpc transmit(BizMessage) returns (BizMessageRsp) {}
hujiebin's avatar
hujiebin committed
136 137 138
  rpc enterRoom(EnterRoomMessage) returns (EnterRoomMessageRsp) {}
  rpc leaveRoom(LeaveRoomMessage) returns (LeaveRoomMessageRsp) {}
  rpc roomHeartbeat(RoomHeartbeatMessage) returns (RoomHeartbeatMessageRsp) {}
139
  rpc getLastRoomHeartbeat(GetLastRoomHeartbeatMessage) returns (GetLastRoomHeartbeatMessageResp) {}
hujiebin's avatar
hujiebin committed
140
}