ConnectionCheck class
Utility to diagnose connection issues with a LiveKit server, a Dart port
of the ConnectionCheck helper from client-sdk-js.
Run it proactively (e.g. at app start) or reactively when connecting to a room fails, to determine why a connection cannot be established (firewall, VPN, blocked TURN, etc.).
final connectionCheck = ConnectionCheck(url, token);
final listener = connectionCheck.createListener();
listener.on<ConnectionCheckUpdateEvent>((event) {
print('check ${event.info.name}: ${event.info.status}');
});
// the recommended minimum set of checks
await connectionCheck.checkWebsocket();
await connectionCheck.checkWebRTC();
await connectionCheck.checkTURN();
print('all checks passed: ${connectionCheck.isSuccess}');
await listener.dispose();
await connectionCheck.dispose();
Each check connects to the server independently and returns a CheckInfo describing the outcome. checkPublishAudio, checkPublishVideo and checkConnectionProtocol capture from the microphone/camera and therefore require the corresponding permissions to be granted beforehand.
- Mixed-in types
Constructors
- ConnectionCheck(String url, String token, {CheckerOptions? options})
Properties
- disposeFuncCount → int
-
no setterinherited
-
events
→ EventsEmitter<
ConnectionCheckEvent> -
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
no setterinherited
- isSuccess → bool
-
True when no check has failed (so far).
no setter
- options → CheckerOptions
-
Options shared by all checks of this run.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- token → String
-
Access token used for the checks.
final
- url → String
-
URL of the LiveKit server to run the checks against.
final
Methods
-
checkCloudRegion(
) → Future< CheckInfo> - Checks connection quality to the closest LiveKit Cloud regions and determines the best one. Skipped for non-Cloud servers. The returned CheckInfo.data contains the best region's RegionStats.
-
checkConnectionProtocol(
) → Future< CheckInfo> - Compares connection quality between UDP and TCP.
-
checkPublishAudio(
) → Future< CheckInfo> - Verifies that microphone audio can be captured and published.
-
checkPublishVideo(
) → Future< CheckInfo> - Verifies that camera video can be captured and published.
-
checkReconnect(
) → Future< CheckInfo> - Verifies that a connection can be resumed after an interruption.
-
checkTURN(
) → Future< CheckInfo> - Verifies that a connection via a TURN relay can be established.
-
checkWebRTC(
) → Future< CheckInfo> - Verifies that a WebRTC (peer) connection can be established.
-
checkWebsocket(
) → Future< CheckInfo> - Verifies that a WebSocket connection to the server can be established.
-
createListener(
{bool synchronized = false}) → EventsListener< ConnectionCheckEvent> -
inherited
-
dispose(
) → Future< bool> -
inherited
-
getResults(
) → List< CheckInfo> - Results of all checks that have been run (or are running).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
OnDisposeFunc func) → void -
inherited
-
runCheck(
Checker check) → Future< CheckInfo> - Runs a single Checker, reporting its progress through ConnectionCheckUpdateEvents, and disposes it when done.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited