Skip to content

Latest commit

 

History

History
102 lines (70 loc) · 2.54 KB

File metadata and controls

102 lines (70 loc) · 2.54 KB

Protocol reference

Protocol version: 1. Schema format: 1.

Framing: DataLen uint32 LE + MsgID uint32 LE + DataLen bytes of UTF-8 JSON. DataLen excludes the 8-byte header. ProtocolVersion is metadata; it is not added to the wire. Request and response use the same message ID. No automatic validation, routing or serialization is generated.

ID Message Description
1001 Authenticate TCP 会话鉴权;Token 由现有 HTTP 登录接口签发。
1002 Heartbeat 更新会话活跃时间,不延长 Token 的绝对有效期。
2001 JoinRoom 加入应用定义的房间。
2002 LeaveRoom 离开当前房间。
3001 Progress 查询当前示例存档。
3002 StarterReward 领取一次性奖励;发放规则仍由 Go 示例业务实现。
3003 UseItem 消耗示例道具;库存和事务由应用负责。

AuthenticateRequest

Field Type Optional Description
token string false

AuthenticateResponse

Field Type Optional Description
code string false
data json true

HeartbeatRequest

Empty JSON object ({}).

HeartbeatResponse

Field Type Optional Description
code string false
data json true

JoinRoomRequest

Field Type Optional Description
room_id uint32 false

JoinRoomResponse

Field Type Optional Description
code string false
data json true

LeaveRoomRequest

Empty JSON object ({}).

LeaveRoomResponse

Field Type Optional Description
code string false
data json true

ProgressRequest

Empty JSON object ({}).

ProgressResponse

Field Type Optional Description
code string false
data json true

StarterRewardRequest

Empty JSON object ({}).

StarterRewardResponse

Field Type Optional Description
code string false
data json true

UseItemRequest

Field Type Optional Description
item_id string false

UseItemResponse

Field Type Optional Description
code string false
data json true