I have deployed my own instance of livekit server ...
# ask-ai
g
I have deployed my own instance of livekit server on AWS. this is the error i get: livekit-client.esm.mjs:13368 WebSocket connection to 'ws://tele.fintaar.ai/rtc?access_token=eyJhbGciOiJIUzI1NiJ9.eyJhdHRyaWJ1dGVzIjp7fSwibmFtZSI6ImlkZW50aXR5LTM1MEMiLCJ2aWRlbyI6eyJyb29tIjoicm9vbS1CanJVLWkxV1QiLCJyb29tSm9pbiI6dHJ1ZSwiY2FuUHVibGlzaCI6dHJ1ZSwiY2FuUHVibGlzaERhdGEiOnRydWUsImNhblN1YnNjcmliZSI6dHJ1ZSwiY2FuVXBkYXRlT3duTWV0YWRhdGEiOnRydWV9LCJpc3MiOiJBUElTQXhRbWFBVzYybTkiLCJleHAiOjE3NTkzMjM1NjEsIm5iZiI6MCwic3ViIjoiaWRlbnRpdHktMzUwQyJ9._xvfHya44i9vK8WjtIWH8Fa9wFXiEFDqsJusbGUxbZs&auto_subscribe=1&sdk=js&version=2.11.4&protocol=15' failed: WebSocket is closed before the connection is established. eval @ livekit-client.esm.mjs:13368 fulfilled @ livekit-client.esm.mjs:6809 Promise.then step @ livekit-client.esm.mjs:6811 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 close @ livekit-client.esm.mjs:13343 eval @ livekit-client.esm.mjs:13224 setTimeout eval @ livekit-client.esm.mjs:13223 fulfilled @ livekit-client.esm.mjs:6809 Promise.then step @ livekit-client.esm.mjs:6811 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 eval @ livekit-client.esm.mjs:13215 connect @ livekit-client.esm.mjs:13215 eval @ livekit-client.esm.mjs:13188 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 join @ livekit-client.esm.mjs:13183 eval @ livekit-client.esm.mjs:17494 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 join @ livekit-client.esm.mjs:17486 eval @ livekit-client.esm.mjs:22424 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Room.connectSignal @ livekit-client.esm.mjs:22422 eval @ livekit-client.esm.mjs:22499 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Room.attemptConnection @ livekit-client.esm.mjs:22477 eval @ livekit-client.esm.mjs:22380 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 connectFn @ livekit-client.esm.mjs:22369 eval @ livekit-client.esm.mjs:22416 eval @ livekit-client.esm.mjs:12092 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Future.promise.Promise.finally._a @ livekit-client.esm.mjs:12088 Future @ livekit-client.esm.mjs:12088 eval @ livekit-client.esm.mjs:22415 fulfilled @ livekit-client.esm.mjs:6809 Promise.then step @ livekit-client.esm.mjs:6811 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Room.connect @ livekit-client.esm.mjs:22325 eval @ room-BgiuQa2X.mjs:171 commitHookEffectListMount @ react-dom.development.js:23184 commitPassiveMountOnFiber @ react-dom.development.js:24960 commitPassiveMountEffects_complete @ react-dom.development.js:24925 commitPassiveMountEffects_begin @ react-dom.development.js:24912 commitPassiveMountEffects @ react-dom.development.js:24900 flushPassiveEffectsImpl @ react-dom.development.js:27073 flushPassiveEffects @ react-dom.development.js:27018 eval @ react-dom.development.js:26803 workLoop @ scheduler.development.js:266 flushWork @ scheduler.development.js:239 performWorkUntilDeadline @ scheduler.development.js:533Understand this warning livekit-client.esm.mjs:17514 Couldn't connect to server, attempt 1 of 1 {room: undefined, roomID: undefined, participant: undefined, pID: undefined} eval @ livekit-client.esm.mjs:17514 rejected @ livekit-client.esm.mjs:6810 Promise.then step @ livekit-client.esm.mjs:6811 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 join @ livekit-client.esm.mjs:17486 eval @ livekit-client.esm.mjs:22424 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Room.connectSignal @ livekit-client.esm.mjs:22422 eval @ livekit-client.esm.mjs:22499 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Room.attemptConnection @ livekit-client.esm.mjs:22477 eval @ livekit-client.esm.mjs:22380 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 connectFn @ livekit-client.esm.mjs:22369 eval @ livekit-client.esm.mjs:22416 eval @ livekit-client.esm.mjs:12092 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Future.promise.Promise.finally._a @ livekit-client.esm.mjs:12088 Future @ livekit-client.esm.mjs:12088 eval @ livekit-client.esm.mjs:22415 fulfilled @ livekit-client.esm.mjs:6809 Promise.then step @ livekit-client.esm.mjs:6811 eval @ livekit-client.esm.mjs:6812 __awaiter @ livekit-client.esm.mjs:6808 Room.connect @ livekit-client.esm.mjs:22325 eval @ room-BgiuQa2X.mjs:171 commitHookEffectListMount @ react-dom.development.js:23184 commitPassiveMountOnFiber @ react-dom.development.js:24960 commitPassiveMountEffects_complete @ react-dom.development.js:24925 commitPassiveMountEffects_begin @ react-dom.development.js:24912 commitPassiveMountEffects @ react-dom.development.js:24900 flushPassiveEffectsImpl @ react-dom.development.js:27073 flushPassiveEffects @ react-dom.development.js:27018 eval @ react-dom.development.js:26803 workLoop @ scheduler.development.js:266 flushWork @ scheduler.development.js:239 performWorkUntilDeadline @ scheduler.development.js:533Understand this warning room-BgiuQa2X.mjs:172 ConnectionError: could not establish signal connection: room connection has timed out (signal) at Room.eval (livekit-client.esm.mjs2250732) at Generator.next (<anonymous>) at fulfilled (livekit-client.esm.mjs680958) eval @ room-BgiuQa2X.mjs:172 Promise.catch eval @ room-BgiuQa2X.mjs:171 commitHookEffectListMount @ react-dom.development.js:23184 commitPassiveMountOnFiber @ react-dom.development.js:24960 commitPassiveMountEffects_complete @ react-dom.development.js:24925 commitPassiveMountEffects_begin @ react-dom.development.js:24912 commitPassiveMountEffects @ react-dom.development.js:24900 flushPassiveEffectsImpl @ react-dom.development.js:27073 flushPassiveEffects @ react-dom.development.js:27018 eval @ react-dom.development.js:26803 workLoop @ scheduler.development.js:266 flushWork @ scheduler.development.js:239 performWorkUntilDeadline @ scheduler.development.js:533Understand this warning voice.tsx:142 ConnectionError: could not establish signal connection: room connection has timed out (signal) at Room.eval (livekit-client.esm.mjs2250732) at Generator.next (<anonymous>) at fulfilled (livekit-client.esm.mjs680958)
t
Thanks for reaching out, Dhruv. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm sorry to hear you're encountering the error "WebSocket is closed before the connection is established." This usually happens because of network or configuration hiccups, but don't worry—we can work through it together! Here are some steps that might help resolve the issue: 1. Verify Network and Port Configuration: Please double-check that your AWS instance is set up to allow inbound traffic on these important ports:Also, make sure your domain's DNS is correctly pointing to the public IP of your AWS instance. ◦ TCP 443 (for secure WebSocket connections via
wss://
) ◦ TCP 7880 and 7881 (used by LiveKit for signaling) ◦ UDP 7882 (used for media via WebRTC) 1. Ensure Valid SSL/TLS Certificates: If you're using
wss://
, it's essential to have valid SSL certificates installed on your server. Without this, the WebSocket handshake might not complete successfully. 2. Use the Connection Test Utility: I recommend running the LiveKit Connection Test utility—it’s a handy tool that can help diagnose any issues with WebSocket and WebRTC connectivity. 3. Adjust Client-Side Timeout: Sometimes, if your AWS instance experiences high latency, increasing the WebSocket timeout in the JavaScript SDK can make a difference. Here's how you can do it:
Copy code
signalClient.join(url, token, {
  autoSubscribe: true,
  websocketTimeout: 15000 // Adjust timeout as needed
});
If after trying these steps the issue still persists, it might be helpful to check your server logs for any errors related to WebSocket connections or if proxies/load balancers are closing connections too early. Please feel free to reach out if you’d like me to guide you through any of these steps or if you have more questions—I’m here to help! Sources: Running LiveKit on AWS | Diagnosing Connection Errors with Connection Test Utility | src/connectionHelper/checks/websocket.ts | signalling/signaltransport_websocket.go | How to Send Logs from the JavaScript SDK to Providers like Datadog
g
we are using ws
t
Since you are using
ws://
(non-secure WebSocket), let's make sure a few things are set up correctly to help you out: 1. Network Configuration: Please double-check that your AWS instance allows inbound traffic on TCP port 7880, as this port is essential for signaling with non-secure WebSocket connections. 2. DNS Configuration: It’s important to confirm that your domain's DNS (like an A record) is correctly pointing to the public IP of your AWS instance. 3. Server Configuration: Make sure your LiveKit server is set up to accept non-secure WebSocket connections. Also, take a peek at the server logs to see if there are any WebSocket-related errors. 4. Client-Side Timeout: If you’re experiencing connection timeouts, you might want to increase the WebSocket timeout in the JavaScript SDK like this:
Copy code
signalClient.join(url, token, {
  autoSubscribe: true,
  websocketTimeout: 15000 // Adjust timeout as needed
});
Just a friendly note: using
ws://
isn’t usually recommended for production because of security reasons. If you can, switching to
wss://
with proper SSL/TLS certificates would be a safer bet for your communication. If you’d like, I’m here to help guide you through that process or anything else you need!
g
the agent is dispatched but I get the anbve errr I gave yu
t
I'd love to help you get to the bottom of this! Could you please share a bit more detail on the following? • Have you noticed any specific errors or logs from the LiveKit server when the agent is dispatched? • Is this issue happening across all clients, or only on certain devices or networks? • Have you checked if the LiveKit server is reachable from the client side, maybe using tools like
telnet
or
curl
? • Are there any reverse proxies (like Nginx) or load balancers set up in front of the LiveKit server? Getting this info will really help us understand the situation better and find the right solution for you.