fresh-hairdresser-44285
09/25/2025, 12:54 PMtall-airline-16756
09/25/2025, 12:54 PMtall-airline-16756
09/25/2025, 12:55 PMfresh-hairdresser-44285
09/25/2025, 12:57 PMtall-airline-16756
09/25/2025, 12:58 PMConnectionCheck class from the @livekit/client-sdk, which offers a handy API to run connectivity diagnostics programmatically.
Here’s a simple way to get started:
1. Install the SDK: First, add the LiveKit client SDK to your project by running:
npm install @livekit/client-sdk
2. Initialize ConnectionCheck: Then, create a test instance using your LiveKit server URL and a participant token:
import { ConnectionCheck } from '@livekit/client-sdk';
const checker = new ConnectionCheck({
url: 'your-project-url',
token: 'your-token'
});
3. Run Tests: You can check your connectivity by calling methods like checkWebsocket(), checkWebRTC(), and `checkTURN()`:
const websocketResult = await checker.checkWebsocket();
const webrtcResult = await checker.checkWebRTC();
const turnResult = await checker.checkTURN();
4. Handle Results: Take a look at the results to help diagnose any issues. For example:
if (websocketResult.status === 'FAILED' &&
webrtcResult.status === 'FAILED' &&
turnResult.status === 'FAILED') {
// This might indicate a firewall or VPN blocking the connection
}
5. Trigger Tests: It’s a good idea to run these tests either when your app starts or whenever a connection error happens.
If you have any questions along the way or need help with implementation or generating tokens, please don’t hesitate to reach out—I’m here to support you!
Sources: src/connectionHelper/ConnectionCheck.ts | Diagnosing Connection Errors with Connection Test Utilityfresh-hairdresser-44285
09/25/2025, 2:23 PMtall-airline-16756
09/25/2025, 2:24 PM