quaint-librarian-68090
09/26/2025, 6:29 AMaiohttp.client_exceptions.ConnectionTimeoutError: Connection timeout to host wss://livekit-server/agenttall-airline-16756
09/26/2025, 6:30 AMtall-airline-16756
09/26/2025, 6:30 AMaiohttp.client_exceptions.ConnectionTimeoutError. This usually happens when the client can't establish a WebSocket connection within the set timeout period. Let's work through some steps together to help resolve this:
• Increase Timeout: You can adjust the timeout by configuring APIConnectOptions. Here's a simple example:
from livekit.agents import APIConnectOptions
conn_options = APIConnectOptions(timeout=10.0) # Set timeout to 10 seconds
• Retry Logic: Sometimes, transient issues happen. Adding retry logic can be really helpful:
conn_options = APIConnectOptions(
timeout=5.0,
max_retry=3,
retry_interval=1.0 # Wait between retries
)
• Authorization: Double-check that your Authorization header is set correctly with valid credentials.
• WebSocket URL: Make sure the URL you're using starts with the correct scheme (ws:// or wss://).
• Handle Exceptions: It’s a good idea to catch and manage APITimeoutError in your code so you can provide fallback options gracefully.
I hope these suggestions help you move forward! If you have any questions or need more support, please feel free to reach out. I'm here to help!
Sources: tests/test_tts.py | Remote method calls (RPC) | LiveKit Docs