I am Using docker to run local livekit server for ...
# ask-ai
r
I am Using docker to run local livekit server for develop ment purpose but facing when update permision failed to send request: cURL error 7: Failed to connect to localhost port 7880 after 0 ms: Could not connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost:7880//twirp/livekit.RoomService/UpdateParticipant
t
Thanks for reaching out, Jovinary. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The error you're encountering, "cURL error 7: Failed to connect to localhost port 7880," occurs because
localhost
inside a Docker container refers to the container itself, not the host machine where your LiveKit server is running. To resolve this, you need to use the correct IP address to connect to the host machine: • For MacOS and Windows: Use
host.docker.internal
instead of
localhost
. Example:
<ws://host.docker.internal:7880>
• For Linux: Use
172.17.0.1
instead of
localhost
. Example:
<ws://172.17.0.1:7880>
Ensure your configuration files are updated accordingly. For example: Sources: test/integration/livekit_test.go | README.md | Self-hosting the Egress Service | LiveKit Docs | Ports and firewall | LiveKit Docs
r
is there no other way consider my setup bellow services: livekit: image: livekit/livekit-server command: --dev --bind 0.0.0.0 ports: - 7880:7880 - 7881:7881 - 7882:7882/udp - 3478:3478/udp - "5000-5350:5000-5350/udp" # First range (UDP) - "5352:352/udp" # First range (UDP) - "5354-6000:5354-6000/udp" networks: - live-network - app-network hostname: livekit frontend: build: context: ./virtualcourt-frontend dockerfile: npm.dockerfile container_name: react_app ports: - "5173:5173" volumes: - ./virtualcourt-frontend:/app - /app/node_modules environment: - NODE_ENV=development - CHOKIDAR_USEPOLLING=true - HOST=0.0.0.0 # Add this line stdin_open: true tty: true command: ["npm", "run", "dev", "--", "--host"] # Explicit host flag networks: - live-network - app-network
t
Hey there! Based on your setup, there are a few other ways we can tackle the connection issue without relying on
host.docker.internal
or
172.17.0.1
. Here are some ideas you might find helpful: • Use Host Networking: You can set up the LiveKit service to use the host network by adding
network_mode: host
to the LiveKit service in your
docker-compose.yml
. This way, the container shares the host's network stack, making
localhost
directly accessible. • Expose Specific Hostnames: If you'd prefer a custom hostname, you can add the
extra_hosts
directive to your
docker-compose.yml
to map a hostname to the host's IP address. For example:
Copy code
extra_hosts:
  - "livekit.local:127.0.0.1"
• Ensure Proper Port Binding: Looks like your current setup already exposes the needed ports. Just double-check that the LiveKit server is running and reachable on those ports from inside the container. • Verify Network Connectivity: Since you’re using multiple networks (
live-network
and
app-network
), make sure the containers can talk to each other across these networks. You might want to check the network settings or consider using Docker’s
bridge
network mode for smoother inter-container communication. Hopefully, these tweaks help clear up the connectivity hiccup while keeping your multi-network setup intact. If you want me to walk you through any of these or have more questions, just let me know—I’m here to help! Sources: tests/docker-compose.yml | Self-hosting the Ingress Service | LiveKit Docs | Self-hosting the Ingress Service | LiveKit Docs | docker-compose.yaml | Deploy to a VM | LiveKit Docs
The
UpdateParticipant
method in LiveKit is usually accessed through HTTP protocols like Twirp, rather than WebSocket. Just to make sure I’m on the right track—are you trying to: • Send real-time updates from the server to clients using WebSockets? • Call
UpdateParticipant
via WebSocket instead of HTTP? If you can share a bit more about what you’re aiming for, I’d be happy to help figure out the best way to make it happen or suggest some alternatives. Sources: packages/livekit-server-sdk/src/RoomServiceClient.ts | livekit-api/src/services/room.rs | Participant attributes and metadata | LiveKit Docs | Participant attributes and metadata | LiveKit Docs | livekit-api/livekit/api/room_service.py
Hey there! That "cURL error 1: Protocol 'wss' disabled" pops up because the LiveKit RoomService
UpdateParticipant
API works over regular HTTP/HTTPS, not WebSocket Secure (wss). No worries though, here’s how you can fix it: 1. Make sure your request URL starts with
http://
or
https://
, not
wss://
. The right endpoint looks like this:
<YOUR_SERVER_URL>/twirp/livekit.RoomService/UpdateParticipant
. 2. Set the correct
Content-Type
header—use
application/json
if you’re sending JSON, or
application/protobuf
if you’re using Protobuf. 3. Don’t forget to include the
Authorization
header with a JWT token that has
roomAdmin
permissions for the room you’re targeting. If you want to make things even smoother, try one of LiveKit’s official server SDKs—they handle all the tricky HTTP stuff, headers, and authentication for you: • Node.js: Use
roomService.updateParticipant()
from
livekit-server-sdk
. • Python: Use
room_service.update_participant()
from
livekit-api
. • Kotlin: Use
roomServiceClient.updateParticipant()
from
livekit-server-sdk-kotlin
. These SDKs really help cut down on errors and make your life easier. If you hit any snags or want a hand, just give me a shout—I’m here to help! Sources: packages/livekit-server-sdk/src/RoomServiceClient.ts | livekit-api/livekit/api/room_service.py | livekit/livekit_room.twirp.go | src/main/kotlin/io/livekit/server/RoomServiceClient.kt | pkg/service/roomservice.go