From 3b93a0e4ee6428c7fa9db12360e37362ed65c9f0 Mon Sep 17 00:00:00 2001 From: Ben Cherry Date: Mon, 13 Jan 2025 16:30:36 -0800 Subject: [PATCH] fixes --- .../LiveKit/Core/Room+EngineDelegate.swift | 21 +++++++++++++++---- .../Participant/LocalParticipant.swift | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Sources/LiveKit/Core/Room+EngineDelegate.swift b/Sources/LiveKit/Core/Room+EngineDelegate.swift index 85c91d601..bc3394501 100644 --- a/Sources/LiveKit/Core/Room+EngineDelegate.swift +++ b/Sources/LiveKit/Core/Room+EngineDelegate.swift @@ -242,12 +242,25 @@ extension Room { func room(didReceiveRpcResponse response: Livekit_RpcResponse) { let requestId = response.requestID - let payload = response.payload - let error = response.error - + let payload: String? + let error: RpcError? + switch response.value { + case .payload(let v): + payload = v + error = nil + case .error(let e): + error = .fromProto(e) + payload = nil + default: + log("[Rpc] Response without payload nor error \(response)") + payload = nil + error = nil + break + } + localParticipant.handleIncomingRpcResponse(requestId: requestId, payload: payload, - error: .fromProto(error)) + error: error) } func room(didReceiveRpcAck ack: Livekit_RpcAck) { diff --git a/Sources/LiveKit/Participant/LocalParticipant.swift b/Sources/LiveKit/Participant/LocalParticipant.swift index d33a68fb0..eeabf02fa 100644 --- a/Sources/LiveKit/Participant/LocalParticipant.swift +++ b/Sources/LiveKit/Participant/LocalParticipant.swift @@ -564,6 +564,7 @@ extension LocalParticipant { $0.method = method $0.payload = payload $0.responseTimeoutMs = UInt32(responseTimeout * 1000) + $0.version = 1 } }