|
|
3 lat temu | |
|---|---|---|
| protos | 3 lat temu | |
| .gitignore | 4 lat temu | |
| README.md | 3 lat temu | |
| golang.md | 4 lat temu | |
| protoc.exe | 4 lat temu | |
| run.bat | 4 lat temu |
消息是前后端通讯的内容的封装
消息是拼接的二进制流
消息由 4 段数据拼接而成, act + type + body length + body
act将body映射到对应的数据对象body的类型, 目前支持两种(0=json;1=protobuf)body的数据长度, 可以避免保证数据读取的完整性c -> s 表示客户端给服务器的消息s -> c 表示服务器器给客户端的消息c -> s 消息中, 带有 request 的消息, 服务器都有响应一个对应的 response 消息notify消息, 表示客户端通知服务器某些行为, 服务器知道就行了, 不需要返回任何数据push 消息, 表示服务器通知客户端某些行为, 客户端需要| 协议号 | message | 方向 | 备注 |
|---|---|---|---|
| 4 | SYN | c -> s | 客户端SYN请求 |
| 4 | SYN | s -> c | 服务器响应SYN请求 |
| 5 | CloseNotify | c -> s | 客户端关闭连接 |
| 5 | ClosePush | s -> c | 服务器关闭用户连接 |
| 10 | LoginRequest | c -> s | 客户端请求登陆 |
| 11 | LoginResponse | s -> c | 服务器响应登陆请求 |
| 12 | HeartbeatRequest | c -> s | 客户端心跳 |
| 13 | HeartbeatResponse | s -> c | 服务器心跳 |
| 14 | ChatNotify | c -> s | 发送聊天消息 |
| 15 | ChatPush | s -> c | 推送聊天消息 |
| 16 | SwitchWorldReques | c -> s | 发送切换世界请求 |
| 17 | SwitchWorldResponse | s -> c | 服务器响应切换世界结果 |
| 18 | UpdateUserinfoRequest | c -> s | 客户端更新用户信息 |
| 19 | UpdateUserinfoResponse | s -> c | 服务器响应更新用户信息 |
| 20 | UpdateUserinfoPush | s -> c | 服务器推送用户信息更新 |
| 100 | LobbyJoinPush | s -> c | 用户加入大厅 |
| 101 | LobbyLeavePush | s -> c | 用户离开大厅 |
| 120 | RoomCreateRequest | c -> s | 客户端请求创建房间 |
| 121 | RoomCreateResponse | s -> c | 服务器响应创建房间请求 |
| 122 | RoomJoinRequest | c -> s | 客户端请求加入房间 |
| 123 | RoomJoinResponse | s -> c | 服务器响应加入房间请求 |
| 124 | RoomJoinPush | s -> c | 服务端推送用户加入房间消息 |
| 125 | RoomLeaveRequest | c -> s | 客户端请求退出房间 |
| 126 | RoomLeaveResponse | s -> c | 服务器响应退出房间 |
| 127 | RoomLeavePush | s -> c | 服务器推送用户离开房间消息 |
| 128 | RoomSwitchMasterPush | c -> s | 切换主机通知 |
| 129 | RoomHangupRequest | c -> s | 客户端请求暂离房间 |
| 130 | RoomHangupResponse | s -> c | 服务器响应暂离房间 |
| 150 | RestoreRequest | c -> s | 客户端请求恢复数据 |
| 151 | RestoreResponse | s -> c | 服务器响应当前状态 |
| 152 | SyncRequest | c -> s | 客户端同步数据 |
| 153 | SyncResponse | s -> c | 服务器响应同步结果 |
| 154 | SyncPush | s -> c | 服务器通知客户端想要他人的同步数据 |
| 155 | MasterPush | s -> c | 服务器合并lockStep的消息给master |
| 156 | MasterNotify | c -> s | master通知服务器广播数据给follow |
| 157 | MasterStoreNotify | c -> s | master存储状态 |
| 158 | MasterLoadRequest | c -> s | master读取状态 |
| 159 | MasterLoadResponse | s -> c | 服务器响应master状态 |
| 160 | DMessageRequest | c -> s | 客户端发送消息给其他人 |
| 161 | DMessageResponse | s -> c | 服务端响应协议结果 |
| 162 | DMessagePush | s -> c | 服务端转发消息给其他人 |
| 163 | MasterNotifyResponse | s -> c | 服务器收到masterNotify的响应 |
| 170 | PartyJoinRequest | c -> s | 请求加入派对 |
| 171 | PartyJoinResponse | s -> c | 加入派对响应 |
| 172 | PartyJoinPush | s -> c | 推送其他人加入派对的消息 |
| 173 | PartyLeaveRequest | c -> s | 请求退出派对 |
| 174 | PartyLeaveResponse | s -> c | 退出派对响应 |
| 175 | PartyLeavePush | s -> c | 退出派对消息推送 |
| 176 | PartyReadyRequest | c -> s | 请求已准备 |
| 177 | PartyReadyResponse | s -> c | 响应已准备 |
| 178 | PartyReadyPush | s -> c | 推送已准备 |
| 179 | PartyFullPush | s -> c | 推送房间已满 |
| 180 | PartyResetPush | s -> c | 推送房间重置 |
| 181 | PartyFinishPush | s -> c | 推送房间结束 |
| 182 | PartyStageCrossRequest | c -> s | 请求通关小关卡 |
| 183 | PartyStageCrossResponse | s -> c | 响应通关小关卡 |
| 184 | PartyStageCrossPush | s -> c | 推送其他人通关小关卡 |
| 185 | PartyStageStartPush | s -> c | 推送小关卡开始 |
| 186 | PartyStageFinishPush | s -> c | 推送小关卡结束 |
| 187 | PartySyncRequest | c -> s | 客户端同步数据 |
| 188 | PartySyncResponse | s -> c | 服务器响应同步结果 |
| 189 | PartySyncPush | s -> c | 服务器通知客户端想要他人的同步数据 |
| 190 | PartyListRequest | c -> s | 请求大厅派对列表 |
| 191 | PartyListResponse | s -> c | 服务器响应大厅列表 |