feat: add ConnectionCheck utility for connection diagnostics#1134
Open
kNoAPP wants to merge 6 commits into
Open
feat: add ConnectionCheck utility for connection diagnostics#1134kNoAPP wants to merge 6 commits into
kNoAPP wants to merge 6 commits into
Conversation
Port the ConnectionCheck (preflight) utility from client-sdk-js (src/connectionHelper) to Dart, so Flutter apps can diagnose why a connection to a LiveKit server fails (firewall, VPN, blocked TURN, etc.) either proactively at app start or reactively on a connection error. Includes all 8 checks from the JS implementation: websocket, WebRTC, TURN, reconnect, publish audio, publish video, connection protocol (UDP vs TCP) and Cloud region, exposed via a ConnectionCheck class with per-check structured results (status, logs, data) and update events using the SDK's EventsEmittable pattern. Browser-only techniques were adapted for Flutter (documented in dartdoc): silence detection via media-source stats instead of WebAudio, camera frame verification via framesSent instead of canvas sampling, a camera track instead of an animated canvas track for the protocol comparison, and qualityLimitationDurations approximated by sampling qualityLimitationReason. Also adds a Connection Check page to the example app, unit tests for the checker lifecycle, orchestration, ICE candidate parsing and the websocket check, plus a README section.
kNoAPP
marked this pull request as ready for review
July 20, 2026 16:27
kNoAPP
requested review from
cloudwebrtc,
hiroshihorie and
xianshijing-lk
as code owners
July 20, 2026 16:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR ports the
ConnectionCheckconnection-diagnostics utility from client-sdk-js to Dart, the same checks that power livekit.io/connection-test. Flutter apps can now run structured preflight diagnostics proactively (at app start) or reactively (whenroom.connect()fails) to determine why a connection cannot be established (firewall, VPN, blocked TURN, etc.), instead of asking users to reproduce on web.Ref: Diagnosing Connection Errors with Connection Test Utility
Demo
API
Testing
flutter test: 364 passing (20 new tests covering theCheckerbase lifecycle,ConnectionCheckorchestration/eventing, ICE candidate parsing, andWebSocketCheckagainst the mock WebSocket connector).flutter analyze,dart format,import_sorter,check_versionpassingExample
example/lib/pages/connection_check.dartadds a "Connection Check" page (launched from the connect screen) that runs all checks and displays per-check status + logs.