@@ -1031,39 +1031,6 @@ internal constructor(
10311031 return engine.sendData(dataPacket)
10321032 }
10331033
1034- /* *
1035- * Establishes the participant as a receiver for calls of the specified RPC method.
1036- * Will overwrite any existing callback for the same method.
1037- *
1038- * Example:
1039- * ```kt
1040- * room.localParticipant.registerRpcMethod("greet") { (requestId, callerIdentity, payload, responseTimeout) ->
1041- * Log.i("TAG", "Received greeting from ${callerIdentity}: ${payload}")
1042- *
1043- * // Return a string
1044- * "Hello, ${callerIdentity}!"
1045- * }
1046- * ```
1047- *
1048- * The handler receives an [RpcInvocationData] with the following parameters:
1049- * - `requestId`: A unique identifier for this RPC request
1050- * - `callerIdentity`: The identity of the RemoteParticipant who initiated the RPC call
1051- * - `payload`: The data sent by the caller (as a string)
1052- * - `responseTimeout`: The maximum time available to return a response
1053- *
1054- * The handler should return a string.
1055- * If unable to respond within [RpcInvocationData.responseTimeout], the request will result in an error on the caller's side.
1056- *
1057- * You may throw errors of type [RpcError] with a string `message` in the handler,
1058- * and they will be received on the caller's side with the message intact.
1059- * Other errors thrown in your handler will not be transmitted as-is, and will instead arrive to the caller as `1500` ("Application Error").
1060- *
1061- * @param method The name of the indicated RPC method
1062- * @param handler Will be invoked when an RPC request for this method is received
1063- * @see RpcHandler
1064- * @see RpcInvocationData
1065- * @see performRpc
1066- */
10671034 override fun registerRpcMethod (
10681035 method : String ,
10691036 handler : RpcHandler ,
@@ -1122,23 +1089,15 @@ internal constructor(
11221089 }
11231090 }
11241091
1125- /* *
1126- * Initiate an RPC call to a remote participant
1127- * @param destinationIdentity The identity of the destination participant.
1128- * @param method The method name to call.
1129- * @param payload The payload to pass to the method.
1130- * @param responseTimeout Timeout for receiving a response after initial connection.
1131- * Defaults to 10000. Max value of UInt.MAX_VALUE milliseconds.
1132- * @return The response payload.
1133- * @throws RpcError on failure. Details in [RpcError.message].
1134- */
11351092 override suspend fun performRpc (
11361093 destinationIdentity : Identity ,
11371094 method : String ,
11381095 payload : String ,
11391096 responseTimeout : Duration ,
11401097 ): String = coroutineScope {
1141- val maxRoundTripLatency = 2 .seconds
1098+ // Maximum amount of time it should ever take for an RPC request to reach the destination, and the ACK to come back
1099+ // This is set to 7 seconds to account for various relay timeouts and retries in LiveKit Cloud that occur in rare cases
1100+ val maxRoundTripLatency = 7 .seconds
11421101
11431102 if (payload.byteLength() > RTCEngine .MAX_DATA_PACKET_SIZE ) {
11441103 throw RpcError .BuiltinRpcError .REQUEST_PAYLOAD_TOO_LARGE .create()
0 commit comments