fix: 适配拍摄任务 WebSocket 分帧订阅回执

This commit is contained in:
2026-11-04 18:23:22 +08:00
parent 9abb5d3bff
commit b3fa6cf7d7
3 changed files with 298 additions and 13 deletions
@@ -138,10 +138,13 @@ final class DroneDockShootingRealtimeSession {
// 记录实际完成本地发送的 310;服务端是否接受仍以 ack 和完整快照为准。
log("request.started", fields: ["body": DroneDockDiagnostics.payload(Data(request.utf8))])
startHeartbeat(generation: current, transport: transport)
case .subscribed(let id, let hasSnapshot):
case .subscribed(let id):
guard subscriptionSent else { throw APIError.decodeFailed("订阅回执先于 310 发送") }
guard id == taskID else { throw APIError.decodeFailed("订阅回执任务不一致") }
subscribed = true
case .subscriptionMetadata(let id, let hasSnapshot):
// 元数据仅描述缓存,不确认订阅、不延长首包期限,也不能降级已有有效快照。
guard subscribed, id == taskID, latestSnapshot == nil else { return }
if !hasSnapshot { update(.fallback("任务缓存尚未就绪,正在通过接口更新")) }
case .snapshot(let snapshot):
guard snapshot.orderFlightTaskID == taskID else {