- 这是采用 3 种消息机制,CGI, PUSH, SYNC
- CGI: 客户端推送消息到服务器,服务器返回消息给客户端
- PUSH: 客户端推送消息到服务器, 服务器不给出任何回应
- SYNC: 服务器推送消息到客户端
- 在包中说明消息类型:{"type": "CGI/PUSH/SYNC"}
- 在包中加入指令:{"command": "xxxxx"}
- 选择座位
client: {
"type": "CGI",
"command": "choose",
"seatID": 0/1/2/3 .. 31
}
server: {
"type": "CGI",
"command": "choose",
"result": "success" | "error reason"
}
- 设置姓名
client: {
"type": "CGI",
"command": "setName",
"name": UTF-8
}
server: {
"type": "CGI",
"command": "setName",
"result": "success" | "error reason"
}
- 更新座位表
server: {
"type": "SYNC",
"command": "seatStatus"
"0": UTF-8, // 座位id对应姓名,如果为 "NULL", 表示该座位上没人
"1": UTF-8,
"2": UTF-8,
...
"31": UTF-8
}