Skip to content

feat(rtc): add PrewarmedConnection - #937

Closed
cnderrauber wants to merge 1 commit into
mainfrom
jie/prewarm-connection
Closed

cnderrauber wants to merge 1 commit into
mainfrom
jie/prewarm-connection

Conversation

@cnderrauber

Copy link
Copy Markdown
Contributor

Depends on

Before merging, bump the livekit-rtc/rust-sdks submodule and the FFI version, then regenerate the protos. The protos in this PR are already generated from the rust-sdks PR branch.

Summary

Exposes the Rust PrewarmedConnection in livekit-rtc: a TCP (+TLS) connection to the server opened ahead of Room.connect, so the connect only does the WebSocket upgrade.

  • rtc.PrewarmedConnection.create(url): opens the connection; raises ConnectError on failure.
  • .alive: whether it can still be used (not used or closed, and the server hasn't closed it).
  • .close(): closes it without using it. Garbage collection also closes it.
  • RoomOptions.prewarmed_connection: used by the first signal connect. If it's dead or for another host, connect dials fresh as usual.

Connect borrows the FFI handle, so Python keeps owning it and disposes it as normal.

conn = await rtc.PrewarmedConnection.create(url)
# ... later
await room.connect(url, token, rtc.RoomOptions(prewarmed_connection=conn))
conn.close()

Used by livekit/agents to keep a connection ready in idle job processes.

🤖 Generated with Claude Code

Add rtc.PrewarmedConnection (create/alive/close) and
RoomOptions.prewarmed_connection to open the signalling TCP/TLS connection
ahead of Room.connect, so the connect only performs the WebSocket upgrade.

The protos are regenerated from the rust-sdks prewarm branch; the rust-sdks
submodule and FFI version still need bumping once livekit-ffi is released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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