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 } }