when I run the project using ```npm run dev``` and...
# ask-ai
r
when I run the project using
Copy code
npm run dev
and open it on localhost:3000, the voice agent from LiveKit works fine. However, when I tried to open it on the machine (e.g., http://192.xxx.x.xx:3000) it doesn't work! and this error displayed in the console:
Copy code
intercept-console-error.ts:44 
 LiveKit room error: ConnectionError: Client initiated disconnect
what's the issue
t
Thanks for reaching out, Roaa. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like you're encountering the error "ConnectionError: Client initiated disconnect" when trying to access your LiveKit project via an IP address instead of
localhost
. This usually happens because the WebSocket URL (
ws_url
) isn’t set up correctly to handle connections from an external IP. Here’s a friendly guide to help you fix this: 1. Double-check that the
ws_url
in your LiveKit server configuration uses a network-accessible IP address rather than
localhost
or
127.0.0.1
. For instance, use your machine’s actual IP or the Docker-accessible IP if you’re working with Docker. 2. If Docker is part of your setup, finding the right IP address is key. On Linux, it’s usually
172.17.0.1
. For macOS or Windows, you can discover it by running this command:
docker run -it --rm alpine nslookup host.docker.internal
3. For production use, a helpful tip is to set
use_external_ip: true
in your LiveKit server configuration. This lets the server automatically find your host’s public IP through STUN, which helps WebRTC connections work smoothly. Once you’ve made these updates, just restart your LiveKit server and give accessing your project via the IP address another try. If you run into any more bumps, I’m here to help! Sources: Self-hosting the Egress Service | LiveKit docs | Self-hosting the Ingress Service | LiveKit docs | Self-hosted SIP server | LiveKit docs | Deploying LiveKit | LiveKit docs