Skip to content

Register the SDK's own transport with livekit-net - #1106

Open
pblazej wants to merge 1 commit into
mainfrom
blaze/rust-net-adapter
Open

Register the SDK's own transport with livekit-net#1106
pblazej wants to merge 1 commit into
mainfrom
blaze/rust-net-adapter

Conversation

@pblazej

@pblazej pblazej commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

livekit-net leaves the WebSocket and HTTP clients to the host, so this wraps the SDK's existing WebSocket/HTTP stack in ~180 lines of adapter rather than adding a second, parallel URLSession implementation — the Rust side inherits .callSignaling QoS, multipath handover and the iOS 26 simulator TLS workaround for free. WebSocket also keeps the HTTP status off a rejected upgrade, which livekit-net carries as TransportError::Http and livekit-signaling maps to SignalError::Handshake, where a 404 gates the v1 → v0 path fallback.

The tests drive the seam from Rust back through the FFI using livekit-net's own self_test_* exports against a live livekit-server, so nothing is asserted against a mock.

Draft: needs livekit-uniffi 0.1.10 — 0.1.9 has no transport seam, so CI can't build this until that release lands (blocked on livekit/rust-sdks#1362).

@pblazej
pblazej force-pushed the blaze/rust-net-adapter branch 3 times, most recently from 0f413f8 to 22d5249 Compare September 2, 2026 14:33
livekit-net leaves the WebSocket and HTTP clients to the host. Rather than
add a second, parallel URLSession stack for the Rust side, adapt the one
already here, so Rust-side signalling inherits the tuning the Swift path
gets: .callSignaling QoS, multipath handover, extended background idle,
the iOS 26 simulator TLS workaround, and the delegate's error logging.

Registration is a lazy global, forced from ConnectionDependencies.init:
process-wide rather than connection-scoped, since livekit-net keeps the
first registration, but that is the earliest construction on the connect
path, so no signalling can outrun it and a Room that never connects pays
nothing.

WebSocket gains a headers/timeout init (SignalClient supplies its own
Authorization header) and keeps the HTTP status off a rejected upgrade,
which is what livekit-net's TransportError::Http carries: livekit-signaling
maps it to SignalError::Handshake, where a 404 gates the v1 -> v0
signalling path fallback and other statuses fail fast rather than driving
a reconnect loop.

HTTP.request now owns the cache policy and timeout as parameters, so the
shared session's URLCache can't serve a stale validate or region response
to either caller.

The tests drive the seam from Rust through the FFI using livekit-net's own
self_test_* exports, so nothing is asserted against a mock.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pblazej
pblazej force-pushed the blaze/rust-net-adapter branch from 22d5249 to cf00102 Compare September 2, 2026 14:46
@pblazej

pblazej commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Blocked by UniFFI release (soon) 🚫 works locally tho

@pblazej
pblazej marked this pull request as ready for review September 2, 2026 14:50
@pblazej
pblazej requested review from 1egoman and ladvoc September 2, 2026 14:53

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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