Skip to content

Expose RPC max round trip latency in performRpc#1023

Merged
pblazej merged 7 commits into
mainfrom
expose-max-round-trip-latency
Jun 1, 2026
Merged

Expose RPC max round trip latency in performRpc#1023
pblazej merged 7 commits into
mainfrom
expose-max-round-trip-latency

Conversation

@1egoman

@1egoman 1egoman commented May 28, 2026

Copy link
Copy Markdown
Contributor

Exposes a new maxRoundTripLatency parameter on LocalParticipant.performRpc (via a new performRpc(destinationIdentity:method:payload:responseTimeout:maxRoundTripLatency:) overload) so that a caller can configure the amount of time they'd like to be able to tolerate between a RPC request being enqueued and a RPCRequest's ACK comes back from the remote participant.

I expect this to be a fairly uncommonly tweaked value, but exposing it means that a client can be configured to tolerate situations where RPC requests are backed up behind other messages due to webrtc head of line blocking on the data channel, and RPC requests are timing out before actually being able to be sent via webrtc.

Related android change: livekit/client-sdk-android#953

@1egoman 1egoman changed the title Expose max round trip latency Expose RPC max round trip latency in performRpc May 28, 2026
@github-actions

github-actions Bot commented May 28, 2026

Copy link
Copy Markdown

⚠️ This PR does not contain any files in the .changes directory.

Comment thread Sources/LiveKit/Participant/LocalParticipant+RPC.swift
@1egoman 1egoman force-pushed the expose-max-round-trip-latency branch from 99e9fa6 to 7ec59c6 Compare May 28, 2026 20:17
@pblazej

pblazej commented May 29, 2026

Copy link
Copy Markdown
Contributor

Could you revert protobuf changes? It's failing due to an unrelated change in swift-protobufs (root cause is #1018)

@1egoman

1egoman commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

Reverted in 8477bc9

@1egoman

1egoman commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

@pblazej Assuming that the ci not fully passing is fine due to your previously surfaced point, anything else you'd like to see on this before it could be merged / released?

@pblazej pblazej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, protocol failure is handled in #1018

@pblazej pblazej merged commit 70ab63b into main Jun 1, 2026
62 of 69 checks passed
@pblazej pblazej deleted the expose-max-round-trip-latency branch June 1, 2026 08:53
1egoman added a commit to livekit/rust-sdks that referenced this pull request Jun 3, 2026
Adds a new `max_round_trip_latency` field to `PerformRpcData`, adding
similar behavior as was added to the corresponding
[swift](livekit/client-sdk-swift#1023) and
[android](livekit/client-sdk-android#953) pull
requests.

Note that this is a **breaking api change**. Per @ladvoc's guidance,
this was deemed to be ok because there isn't really a great way to add
this new field to the `PerformRpcData` struct in a backwards compatible
way.

Given this is a breaking change, I opted to break it in a way where if
we have to add _more_ fields in here in the future, it could be done in
a non breaking way by making `PerformRpcData` use a builder pattern.
That results in something that looks like:
```rust
let output = caller_room.local_participant().perform_rpc(
    PerformRpcData::new("identity", "method") // <-- New builder
        .with_payload("payload")
        .with_response_timeout(Duration::from_secs(5))
).await?;
```

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lukasIO <mail@lukasseiler.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants