继续补全 wss
This commit is contained in:
+16
-11
@@ -10,13 +10,14 @@
|
||||
- 浏览器同时建立了 3 条 `wss://77bc035c-ws.va.huya.com/` 连接。
|
||||
- `scoreExchangePrize` 出现在 WSS 连接数据和静态 JS 中,没有出现在 `cdnws` POST 请求中。
|
||||
- 当前 HTTP 版本可用,是因为 `webActUI` 的 WUP over HTTP 编码已经对齐。
|
||||
- 当前 WSS 版本会超时,是因为 Go 里的 WSS 外层协议模型不符合浏览器 JS。
|
||||
- Go 版 WSS 已改为浏览器同款 `WebSocketCommand` 外层,仍需真实 Cookie 联调确认服务端返回。
|
||||
|
||||
## 连接
|
||||
|
||||
- WebSocket URL:`wss://<host>/?baseinfo=<base64 taf>`
|
||||
- 手动 HAR host:`77bc035c-ws.va.huya.com`
|
||||
- host 来自 `launch.queryHttpDns` 或浏览器抓包,不应长期写死。
|
||||
- 手动 HAR 中 `baseinfo.cookie` 与 `traceId` 为空,cookie 通过后续 `VerifyCookie` 命令发送。
|
||||
- 握手启用 `permessage-deflate`。
|
||||
- 浏览器请求扩展:`permessage-deflate; client_max_window_bits`
|
||||
- 服务端返回扩展:`permessage-deflate;server_no_context_takeover;client_no_context_takeover`
|
||||
@@ -65,6 +66,8 @@ ws.send(WebSocketCommand.writeTo(JceOutputStream))
|
||||
- `6`:`EWSCmdS2C_HeartBeatAck`
|
||||
- `10`:`EWSCmdC2S_VerifyCookieReq`
|
||||
- `11`:`EWSCmdS2C_VerifyCookieRsp`
|
||||
- `16`:`EWSCmdC2S_RegisterGroupReq`
|
||||
- `17`:`EWSCmdS2C_RegisterGroupRsp`
|
||||
- `20`:`EWSCmdC2S_HeartBeatReq`
|
||||
- `21`:`EWSCmdS2C_HeartBeatRsp`
|
||||
- `23`:`EWSCmdC2S_UpdateUserExpsReq`
|
||||
@@ -86,11 +89,15 @@ ws.send(WebSocketCommand.writeTo(JceOutputStream))
|
||||
浏览器 WSS session 的关键流程:
|
||||
|
||||
1. 连接 `wss://<host>/?baseinfo=<base64 taf>`。
|
||||
2. 发送 `EWSCmdC2S_HeartBeatReq`。
|
||||
3. 通过 WSS 调用 `launch.wsLaunch`。
|
||||
4. `wsLaunch` 后触发 `sendWSUpdateUserInfoReq`。
|
||||
5. `launch.queryHttpDns` 仍通过 HTTP `cdnws` 调用。
|
||||
6. 后续 WUP 业务在连接可用时走 `signalSdk.sendWup`,连接不可用时可 fallback 到 `sendWupHttp`。
|
||||
2. 发送 `EWSCmdC2S_RegisterGroupReq(16)`,默认 group 为 `live:0`。
|
||||
3. 通过 WSS 调用 `launch.wsLaunch`,手动 HAR 中 requestId 为 `-1`。
|
||||
4. 发送 `EWSCmdC2S_VerifyCookieReq(10)`,cookie 在这里进入 WSS 通道。
|
||||
5. 通过 WSS 调用 `mobileui.getConfig`。
|
||||
6. 发送 `EWSCmdC2S_UpdateUserExpsReq(23)`,请求体是空 map。
|
||||
7. 再发送一次 `EWSCmdC2S_RegisterGroupReq(16)`。
|
||||
8. 发送 `EWSCmdC2S_HeartBeatReq(20)`,后续维持心跳。
|
||||
9. `launch.queryHttpDns` 仍通过 HTTP `cdnws` 调用。
|
||||
10. 后续 WUP 业务在连接可用时走 `signalSdk.sendWup`,连接不可用时可 fallback 到 `sendWupHttp`。
|
||||
|
||||
响应应按 WUP `iRequestId` 匹配回调,不能只用 FIFO。
|
||||
|
||||
@@ -103,7 +110,7 @@ ws.send(WebSocketCommand.writeTo(JceOutputStream))
|
||||
- `webActUI.getUserPrizeRecords`
|
||||
- `webActUI.scoreExchangePrize`
|
||||
|
||||
WSS 版本仍是实验状态,需要按 `WebSocketCommand` 结构重写。
|
||||
WSS 版本仍是实验状态,但外层 `WebSocketCommand`、初始化帧顺序和 requestId 匹配已按手动 HAR 修正。
|
||||
|
||||
抢购兑换请求结构:
|
||||
|
||||
@@ -130,8 +137,6 @@ tReq.isRole = 1
|
||||
|
||||
## 待完善
|
||||
|
||||
- 实现 TAF `WebSocketCommand` 编解码。
|
||||
- WSS WUP response 按 `iRequestId` 匹配请求。
|
||||
- 实现 `WSUpdateUserInfoReq`、心跳、verify cookie 等浏览器初始化步骤。
|
||||
- 使用真实 Cookie 联调 `list/score/exchange`,确认服务端不再超时。
|
||||
- 自动调用 `launch.queryHttpDns` 获取最新 WSS host。
|
||||
- 增加基于真实抓包样本的 WSS 编解码单测。
|
||||
- 补更多基于真实抓包摘要的 WSS 编解码单测。
|
||||
|
||||
Reference in New Issue
Block a user