What’s the default timeout for RPC response method...
# ask-ai
b
What’s the default timeout for RPC response methods?
Copy code
local_participant.perform_rpc(...)
t
Thanks for reaching out, Martín. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I just wanted to share a little helpful info with you: the default timeout for RPC response methods, like
local_participant.perform_rpc(...)
, is set to 10 seconds. This timeout covers the whole request time, including any network delays you might encounter. But don’t worry—you can easily adjust this by setting a different value for the
responseTimeout
parameter when you call the method. If you need a hand with that, I’m here to help! Sources: Remote method calls (RPC) | LiveKit Docs | Sources/LiveKit/Participant/LocalParticipant+RPC.swift | livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Local... | localparticipant.go
b
I am getting a connection timeout earlier than 10s
t
I'd love to help you get to the bottom of this! Could you share a bit more about your setup? For example: • Are you using a custom
responseTimeout
value in your
perform_rpc
call? • Which SDK or platform are you working with (like Swift, Android, Go)? • Have you noticed any network conditions or logs that might explain why the timeout is happening sooner than expected?
b
This is the error I receive:
Copy code
livekit.rtc.rpc.RpcError: Connection timeout
Using python:
Copy code
livekit-agents==1.0.20
I don’t have a custom response_timeout setting. I tracked this down to the FfiQueue and FfiClient
t
The
CONNECTION_TIMEOUT
error in
livekit.rtc.rpc.RpcError
can happen when the FfiQueue or FfiClient doesn’t get a response within the default 10-second timeout. This might be caused by: • Delays in the FfiQueue processing or an overloaded event loop. • High CPU or memory usage impacting the FFI communication layer. • A slow response from the receiving agent due to a heavy workload. Here are a few steps that might help: 1. Try increasing the
response_timeout
in the
perform_rpc
call to give the response a bit more time. 2. Make sure the target participant has registered the RPC method before you start the call. 3. Keep an eye on system performance and optimize where possible to reduce delays in the FFI communication path. If you’d like, I’m here to guide you through these steps or help with anything else you need. Just let me know! Sources: livekit-rtc/livekit/rtc/room.py | livekit-ffi/src/livekit.proto.rs | packages/livekit-rtc/src/rpc.ts | Remote method calls (RPC) | LiveKit Docs | Sources/LiveKit/Participant/LocalParticipant+RPC.swift
b
The problem is not the response timeout but the connect timeout
t
I'm sorry to hear you're experiencing a connect timeout in
livekit.rtc.rpc.RpcError
. This usually happens when the RPC can't connect to the target participant within the expected time. Let’s walk through some steps that might help resolve this: 1. First, please make sure the target participant is connected to the room and has successfully joined before you start the RPC call. 2. Next, double-check that the target participant has registered the RPC method handler using
localParticipant.registerRpcMethod
. 3. It's also a good idea to verify your network connection, ensuring stable WebSocket connections and that the necessary ports are open. 4. If the timeout persists, you might want to try increasing the
response_timeout
parameter in
perform_rpc
to give the connection a bit more time. 5. Lastly, take a look at any firewall or security settings that could be blocking WebSocket traffic. Please feel free to reach out if you'd like me to guide you through any of these steps or if you need help with anything else. I'm here to help! Sources: Remote method calls (RPC) | LiveKit Docs | livekit-agents/livekit/agents/worker.py | packages/livekit-rtc/README.md | Protocol & WebRTC Implementation | livekit/livekit_composite | DeepWiki | Getting Help & Troubleshooting | livekit/livekit_composite | DeepWiki