feat(server): make rtc.tcp_port configurable via runtime.json + configure RPC #34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/per-user-rtc-tcp-port"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #33.
Summary
rtc_tcp_portfield toRuntimeConfig(with#[serde(default)] = 7881)livekitservice.configureRPC with anrtc_tcp_port: u32parameter (0 = keep current, same convention aslivekit_port/backend_port)render_livekit_yamlreads the value instead of the hardcoded" tcp_port: 7881\n"literalrpc_generated.rs,osis_server_generated.rs,openrpc.json) regenerated from the updatedlivekit.oschemaWhy
The existing
rtc.ips.includes(PR #32) handles the UDP/7882 multi-user collision by binding per-usernode_ip. The TCP-RTC port (default 7881), however, is wildcard-bound (bind_addresses: "0.0.0.0"), so two livekit instances on the same host collide on*:7881withEADDRINUSE. We can't simply restrictbind_addressesbecause the wrapper's own twirp_call (rpc.rs:385) hardcodeshttp://127.0.0.1:<livekit_port>for room-management calls — restricting bind_addresses to node_ip would break that. Per-user TCP port allocation is the cleanest solution.Verification on multi-user dev box
Two users running concurrently after applying this PR + manual configure:
No collisions. RPC tested end-to-end: configure with
rtc_tcp_port=7889→ runtime.json updated → yaml renderstcp_port: 7889. configure withrtc_tcp_port=0→ keeps existing value.Compatibility note (READ BEFORE MERGE)
This is a breaking change for callers of
livekitservice.configure— the dispatcher requires all named params, and addingrtc_tcp_portmakes it required.Single in-tree caller:
service_livekit.nuinlhumina_code/hero_skills. Without a companion 1-line update there, everyservice_livekit startwill fail with"Missing required parameter: rtc_tcp_port".The companion hero_skills PR is small and trivial — adds
rtc_tcp_port: 0to the params object passed to the configure RPC. Both PRs should land together.No external SDK clients exist — verified by grepping
livekitservice.configureacross the org's repos.Follow-up needed in hero_skills (separate issues / PRs)
rtc_tcp_port: 0to service_livekit.nu'scfg_paramsso the configure RPC stops rejecting calls.svx_lk_wipe_stale_configsto preserveruntime.json(delete only yaml + env). Per-user values then survive--reset/ stale-config wipes.[livekit]section fromhero_cfg.tomland passesrtc_tcp_portfrom there to configure RPC.multi_user_addallocates a non-overlapping(livekit_port, rtc_tcp_port, backend_port)triple per user and writes a[livekit]section into the new user'shero_cfg.toml.Until PR-1 lands: operators can configure per-user ports manually via
curl --unix-socket .../rpc.socktolivekitservice.configure. This PR is the necessary foundation; the hero_skills follow-ups close the loop on automation.Test plan
rpc_generated.rswith the new paramrtc_tcp_portand persists it to runtime.jsonrtc_tcp_port: 0keeps existing value (matches livekit_port/backend_port convention)tcp_port: <configured>*:7889test)rtc_tcp_portfield parses cleanly via serde default🤖 Generated with Claude Code