Skip to content

v2.31.0

Latest

Choose a tag to compare

@davidliu davidliu released this 24 Nov 10:29
· 3 commits to main since this release
9d8dcbe

Minor Changes

  • Add a keySize option to BaseKeyProvider (KeyProviderKeySize.BITS_128 by default, or BITS_256) to derive AES-256-GCM frame keys for E2EE. All participants in a room must use the same size. Matches KeyProviderOptions.keySize in the JS and Swift SDKs. - #1061 (@netbrut)

  • Add ConnectOptions.singlePeerConnection, which joins through the /rtc/v1 signal path and publishes and receives on one peer connection instead of a publisher and a subscriber. The client makes every offer; the server's media sections requirement adds receive-only transceivers, and the answer's mid-to-track mapping resolves received tracks. A server without /rtc/v1 answers that handshake with 404, in which case the join retries on the legacy path with dual peer connections and later reconnects stay there. The option is off by default. - #1066 (@changt)

Patch Changes

  • Expose participantIdentity on RoomEvent.DataReceived. The event's participant is nullable and is null whenever the sender is not in the room — data sent through the Server API, or by a participant that has already left. In that case the receiver had no way to tell who sent the data, because the engine dropped the identity before building the event: onUserPacket was handed only the inner UserPacket, while the authoritative identity lives on the enclosing DataPacket. - #1046 (@xianshijing-lk)

    The internal engine listener now forwards that identity, and it is reported on every DataReceived event whether or not the sender resolves to a RemoteParticipant.

    This matches the JavaScript SDK (livekit/client-sdk-js#2092).

  • hasValidToken now validates against its date parameter. Previously the parameter was ignored and the current time was always used. - #1055 (@davidliu)

  • Send track registration before creating the sender during fast publication, preserving overlap with server acceptance in both single and dual peer connection modes. - #1074 (@xianshijing-lk)

  • Add proportional jitter to the default reconnect delays. DefaultReconnectPolicy returned a fixed delay for each retry count, so every client disconnected by the same event — a server restart, a region failover, a dropped uplink — waited exactly 100ms, then 300ms, then 300ms, and so on, in lockstep. They retried as one herd and could keep re-synchronising across attempts. - #1045 (@xianshijing-lk)

    Each delay is now scaled by a random factor between 0.5 and 1.5, spreading clients further apart with every retry. A first retry whose configured delay is zero instead draws from a fixed 0–500ms window, since there is no base delay to scale; a zero at any later index still means retry immediately.

    This matches the JavaScript SDK (livekit/client-sdk-js#2124).

  • Fix not truncating outgoing RpcError messages to 256 bytes and data to 15 KB. - #1044 (@xianshijing-lk)

  • performRpc now fails as soon as the room disconnects, rather than staying suspended until its response timeout. - #1067 (@xianshijing-lk)

    Room cleanup reports every remote participant as disconnected, which already rejected calls addressed to a participant the room knew about. A call to an identity that never appeared in the participant list — an agent that has not joined yet, say — was in no such loop, so it stayed pending for the full responseTimeout after the room had gone. The caller's coroutine is now resumed with RECIPIENT_DISCONNECTED instead.

    This matches the Rust SDK's fail_all_pending and the Swift SDK's handleAllPendingDisconnected (livekit/client-sdk-js#2251).

  • Bundle the publisher offer with the /rtc/v1 join request when connecting with ConnectOptions.singlePeerConnection. The publisher peer connection, its data channels and the first offer are created before the signal connection opens, and the server answers that offer right after the join response, which saves one offer/answer round trip on connect. - #1070 (@changt)

  • Negotiate Opus NACK on every audio section in single peer connection mode, including send-only offers created before any subscriptions, enabling retransmission of lost audio in both publish and subscribe directions when RED is disabled, such as with end-to-end encryption. Accept server-offered Opus NACK in dual peer connection subscriber answers, with fallback if the modified answer is rejected. - #1072 (@xianshijing-lk)

  • Fix caching token source incorrectly calculating the expiration. It now treats a token within the tolerance (default: 60 seconds) as already expired and fetches a fresh one, instead of keeping it past its expiry. - #1055 (@davidliu)

  • Move RTCEngine's peer connections behind an internal Transport interface. DualPeerConnectionTransport implements it for the existing publisher and subscriber peer connection pair and owns the decisions that depend on that arrangement: ICE candidate routing, answering server offers, which peer connections a resume waits on, and the sync state descriptions. No behavior changes. - #1064 (@changt)

  • Fix long RPC error messages and data sometimes ending in a garbled character when truncated in the middle of an emoji or similar character. - #1044 (@xianshijing-lk)