Connect an app with LiveKit SDKs
A client SDK joins a room, publishes local audio and video, and subscribes to other participants' tracks. A server SDK runs on your backend, signs access tokens and calls administrative APIs. The browser only needs the WebSocket URL and a room token.
Make a call in two browser tabs
Start the Rust server with the quickstart, then create the demo room and two tokens by following the CLI guide. Each token must use a different identity. Have Node.js with npm, Python 3, and a browser with a camera and microphone available.
Create a working folder and save the browser example into it as first-call.html. Run these commands from that folder:
npm install --save-exact livekit-client@2.23.0
python3 -m http.server 8000 --bind 127.0.0.1
- Open http://127.0.0.1:8000/first-call.html in two tabs on the same computer as the Rust server.
- Keep
ws://127.0.0.1:7880in the server field. Paste Alice's token in the first tab and Bob's in the second, then click Join in both. - In Alice's tab, click Enable camera and microphone and grant browser access. Alice sees a local preview. Bob should see Alice's video under Remote media. If playback is blocked, click Play audio in Bob's tab. Use headphones to avoid feedback.
- Click Leave when finished and stop the local Python server with Ctrl+C.
If the camera is busy, publish from one tab and receive in the other. If the connection fails, check that the Rust server is running, the token is fresh, and both tabs use distinct identities for the same room. To use another device, deploy an HTTPS page and use a reachable wss:// endpoint. Loopback addresses only work on the machine that runs the service.
Issue tokens and list rooms from Node.js
Save the server SDK example as server-sdk.mjs in your working folder. With the Rust server still running:
npm install --save-exact livekit-server-sdk@2.19.3
export LIVEKIT_URL=http://127.0.0.1:7880
export LIVEKIT_API_KEY=devkey
export LIVEKIT_API_SECRET=secret
node server-sdk.mjs list
node server-sdk.mjs token alice
The first command invoking the script prints room names through the Room Service API. The second prints a ten-minute JWT for Alice in demo. It can replace Alice's CLI-generated token after she leaves. Start a fresh token for each identity.
For an application, use an authenticated backend route. Derive the identity from the signed-in user, check that the user can join the requested room, and sign a short-lived token with only the required grants. Return the WebSocket URL and token to the client over HTTPS. Keep the API secret and administrative calls on your backend.
Choose a client or backend SDK
Use the same room token and reachable WebSocket URL across client SDKs. Use the HTTP or HTTPS API endpoint with your API key and secret on the backend. The examples above cover the browser and Node.js workflows. For other clients, follow the SDK's setup instructions and verify your application against the published compatibility results.
| Building | SDK and integration reference |
|---|---|
| Web or React | JavaScript client SDK · React components |
| iOS or macOS | Swift client SDK |
| Android | Android client SDK |
| Flutter | Flutter client SDK |
| Node.js backend | Node.js server SDK |
| Python, Go, or another backend | LiveKit Server API SDKs |