Question
Is the 5-second auto-refetch of GET /settings/regions while a room stays connected intentional? For long-lived SPA sessions we see ~12 requests/minute to https://{project}.livekit.cloud/settings/regions even when the user is idle (no mic, no chat).
We want to confirm expected behavior and whether there is a supported way to reduce polling frequency without disconnecting the room.
Environment
- SDK:
livekit-client@2.19.0
- Hosting: LiveKit Cloud (
*.livekit.cloud)
- Client: Next.js 15 SPA; room stays connected across in-app navigation (session persistence)
Observed behavior
- On
Room.connect() to a Cloud URL, the client fetches /settings/regions (via RegionUrlProvider).
- While connected, the SDK schedules another fetch every
maxAgeInMs.
- When the response has no
Cache-Control: max-age, DEFAULT_MAX_AGE_MS (5_000) applies.
- Result: ~1 GET every 5 seconds for the entire time the room is connected (~12/min), visible in browser devtools.
This matches RegionUrlProvider in v2.19 (DEFAULT_MAX_AGE_MS = 5_000, scheduleRefetch loop, notifyConnected / notifyDisconnected + STOP_REFETCH_DELAY_MS).
Use case
We hoist a single LiveKit room into our authenticated app shell so customers can navigate (Home → Contracts → Renewals) without tearing down the agent session. The room may stay connected for many minutes while the user browses non-voice pages. Region metadata seems unlikely to need refreshing every 5 seconds during an idle connected session.
Questions
- Is 5s the intended refresh interval for connected clients when Cloud omits
Cache-Control? Or is Cloud expected to return a longer max-age and the 5s default is only a fallback for misconfigured responses?
- Should LiveKit Cloud add
Cache-Control: max-age=… on /settings/regions (e.g. minutes/hours) so clients poll less aggressively?
- Is there a public SDK option to tune region-settings cache TTL or disable background refetch while connected (we did not find one on
Room / RoomConnectOptions)?
- Reconnect/failover: Does the 5s poll materially improve failover vs. refreshing only on connect/reconnect? Would a longer interval (e.g. 5–15 min) be acceptable for most production apps?
What we are not asking for
- We understand region selection is required for Cloud edge routing at connect time.
- We are not seeing connection failures — only frequent background HTTP traffic.
Possible directions (for discussion)
- Increase
DEFAULT_MAX_AGE_MS when server omits cache headers
- Have Cloud return meaningful
Cache-Control on /settings/regions
- Expose a client-configurable region settings TTL
- Stop background refetch while connected once a region is selected, and only refetch on reconnect / explicit failover
Happy to provide HAR captures or a minimal repro if useful.
Question
Is the 5-second auto-refetch of
GET /settings/regionswhile a room stays connected intentional? For long-lived SPA sessions we see ~12 requests/minute tohttps://{project}.livekit.cloud/settings/regionseven when the user is idle (no mic, no chat).We want to confirm expected behavior and whether there is a supported way to reduce polling frequency without disconnecting the room.
Environment
livekit-client@2.19.0*.livekit.cloud)Observed behavior
Room.connect()to a Cloud URL, the client fetches/settings/regions(viaRegionUrlProvider).maxAgeInMs.Cache-Control: max-age,DEFAULT_MAX_AGE_MS(5_000) applies.This matches
RegionUrlProviderin v2.19 (DEFAULT_MAX_AGE_MS = 5_000,scheduleRefetchloop,notifyConnected/notifyDisconnected+STOP_REFETCH_DELAY_MS).Use case
We hoist a single LiveKit room into our authenticated app shell so customers can navigate (Home → Contracts → Renewals) without tearing down the agent session. The room may stay connected for many minutes while the user browses non-voice pages. Region metadata seems unlikely to need refreshing every 5 seconds during an idle connected session.
Questions
Cache-Control? Or is Cloud expected to return a longermax-ageand the 5s default is only a fallback for misconfigured responses?Cache-Control: max-age=…on/settings/regions(e.g. minutes/hours) so clients poll less aggressively?Room/RoomConnectOptions)?What we are not asking for
Possible directions (for discussion)
DEFAULT_MAX_AGE_MSwhen server omits cache headersCache-Controlon/settings/regionsHappy to provide HAR captures or a minimal repro if useful.