Skip to content

feat(realtime): connection pre-warming via startMuted + mute/unmute#3

Merged
AdirAmsalem merged 1 commit into
mainfrom
cpp-sdk-compatibility
Jun 18, 2026
Merged

feat(realtime): connection pre-warming via startMuted + mute/unmute#3
AdirAmsalem merged 1 commit into
mainfrom
cpp-sdk-compatibility

Conversation

@AdirAmsalem

@AdirAmsalem AdirAmsalem commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What

Adds connection pre-warming for realtime sessions, so apps can make the "Start" moment feel instant.

Why

Normally, when a user starts a realtime session there's a noticeable wait while the connection authenticates and the media path is established. Pre-warming lets you do all of that ahead of time and hold the session idle — at no cost — so the instant the user hits Start, generation begins with no startup latency. Billing tracks active generation, so a warmed-but-idle session is free; if the user never starts or cancels, you just disconnect and aren't charged.

What's new (public API)

  • ConnectOptions::startMuted — connect and authenticate now, transmit nothing yet.
  • RealtimeSession::mute() / unmute() — pause/resume transmission at runtime.
decart::ConnectOptions options;
options.model = model;
options.initialState.prompt = decart::Prompt{"A watercolor painting", /*enhance=*/true};
options.startMuted = true;   // warm + authenticate, but stay idle (unbilled)

auto session = client.realtime().connect(source, options);

// When the user clicks Start:
session->unmute();
source->captureFrame(frame); // generation begins here

// Pause without disconnecting — stops generation (and billing), keeps the session warm:
session->mute();

// Resume instantly later:
session->unmute();

// If they cancel entirely:
session->disconnect();       // no charge

Also ships a runnable realtime_warmup example and a README section.

Verified end-to-end: a warmed, idle session incurs no billing, and billing begins only once the session goes live.

Establish an authenticated, idle session up front and hold it unbilled, then
go live with no startup latency. Adds ConnectOptions::startMuted (publishes the
input track muted) and RealtimeSession::mute()/unmute(). An idle WebRTC track
emits keepalive frames, so we mute the LiveKit local track before publishing —
muting, not withholding captureFrame, is what keeps the warmed session free.

Includes the realtime_warmup example, README docs, and thread-safe access to
the published track. Verified live: a session alive 18.4s billed only 5s (the
post-unmute generation window); the muted warmup window billed zero.
@AdirAmsalem AdirAmsalem merged commit e238f6e into main Jun 18, 2026
4 checks passed
@AdirAmsalem AdirAmsalem deleted the cpp-sdk-compatibility branch June 18, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant