Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brave-plums-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"client-sdk-android": patch
---

Allow customizing `maxRoundTripLatency` on `LocalParticipant.performRpc` for high-latency networks
Original file line number Diff line number Diff line change
Expand Up @@ -1142,8 +1142,8 @@ constructor(
localParticipant.unregisterRpcMethod(method)
}

override suspend fun performRpc(destinationIdentity: Participant.Identity, method: String, payload: String, responseTimeout: Duration): String {
return localParticipant.performRpc(destinationIdentity, method, payload, responseTimeout)
override suspend fun performRpc(destinationIdentity: Participant.Identity, method: String, payload: String, responseTimeout: Duration, maxRoundTripLatency: Duration): String {
return localParticipant.performRpc(destinationIdentity, method, payload, responseTimeout, maxRoundTripLatency)
}

// ----------------------------------- RTCEngine.Listener ------------------------------------//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1100,10 +1100,8 @@ internal constructor(
method: String,
payload: String,
responseTimeout: Duration,
maxRoundTripLatency: Duration,
): String = coroutineScope {
// Maximum amount of time it should ever take for an RPC request to reach the destination, and the ACK to come back
// This is set to 7 seconds to account for various relay timeouts and retries in LiveKit Cloud that occur in rare cases
val maxRoundTripLatency = 7.seconds
// Minimum allowed effective timeout to ensure the RPC lifecycle always has at least
// one second to complete, even after accounting for round-trip latency.
val minEffectiveTimeout = 1.seconds
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2025 LiveKit, Inc.
* Copyright 2025-2026 LiveKit, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -82,6 +82,10 @@ interface RpcManager {
* If a value less than 8s is provided, it will be automatically clamped to 8s
* to ensure sufficient time for round-trip latency buffering.
* Defaults to 15 seconds.
* @param maxRoundTripLatency The maximum amount of time it should ever take for an RPC request to
* reach the destination and for the ACK to come back. Defaults to 7 seconds to account
* for various relay timeouts and retries in LiveKit Cloud that occur in rare cases.
* Most callers should not need to change this.
* @return The response payload.
* @throws RpcError on failure. Details in [RpcError.message].
*/
Expand All @@ -90,5 +94,6 @@ interface RpcManager {
method: String,
payload: String,
responseTimeout: Duration = 15.seconds,
maxRoundTripLatency: Duration = 7.seconds,
): String
}
Loading