livekit-client 2.15.10 → 2.15.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1774,6 +1774,7 @@ export default class LocalParticipant extends Participant {
1774
1774
  responseTimeout = 15000,
1775
1775
  }: PerformRpcParams): Promise<string> {
1776
1776
  const maxRoundTripLatency = 7000;
1777
+ const minEffectiveTimeout = maxRoundTripLatency + 1000;
1777
1778
 
1778
1779
  return new Promise(async (resolve, reject) => {
1779
1780
  if (byteLength(payload) > MAX_PAYLOAD_BYTES) {
@@ -1789,14 +1790,9 @@ export default class LocalParticipant extends Participant {
1789
1790
  return;
1790
1791
  }
1791
1792
 
1793
+ const effectiveTimeout = Math.max(responseTimeout, minEffectiveTimeout);
1792
1794
  const id = crypto.randomUUID();
1793
- await this.publishRpcRequest(
1794
- destinationIdentity,
1795
- id,
1796
- method,
1797
- payload,
1798
- responseTimeout - maxRoundTripLatency,
1799
- );
1795
+ await this.publishRpcRequest(destinationIdentity, id, method, payload, effectiveTimeout);
1800
1796
 
1801
1797
  const ackTimeoutId = setTimeout(() => {
1802
1798
  this.pendingAcks.delete(id);
package/src/room/rpc.ts CHANGED
@@ -11,7 +11,12 @@ export interface PerformRpcParams {
11
11
  method: string;
12
12
  /** The method payload */
13
13
  payload: string;
14
- /** Timeout for receiving a response after initial connection (milliseconds). Default: 10000 */
14
+ /**
15
+ * Timeout for receiving a response after the initial connection (milliseconds).
16
+ * If a value less than 8000ms is provided, it will be automatically clamped to 8000ms
17
+ * to ensure sufficient time for round-trip latency buffering.
18
+ * Default: 15000ms.
19
+ */
15
20
  responseTimeout?: number;
16
21
  }
17
22