Skip to main content

LiveKit

LiveKit is an open source project that provides scalable, multi-user conferencing over WebRTC. It's designed to give you everything you need to build real-time audio and/or video experiences in your applications.

Features

  • Horizontally-scalable WebRTC Selective Forwarding Unit (SFU)
  • Modern, full-featured client SDKs for JavaScript, React, Swift, Kotlin, and Flutter (React Native and Unity/C# in development)
  • Built for production - JWT authentication and server APIs
  • Robust networking & connectivity over UDP, TCP, and built-in TURN
  • Easy to deploy: pure Go and single binary
  • Advanced features like speaker detection, simulcast, selective subscription, and moderation APIs

Playground

Head to our playground to try it live. Build a Zoom-like conferencing app in under 100 lines of code!

Why LiveKit?

WebRTC is a powerful protocol that now has ubiquitous support across all major browsers and mobile platforms. However, building apps with it isn't simple; it requires an understanding of core protocol concepts and developers are responsible for complexities like signaling and coordinating connections between peers. As a peer-to-peer protocol, scaling WebRTC to large numbers of peers also becomes challenging.

While hosted solutions like Twilio and Agora exist, they can be costly, have limited flexibility and as proprietary products, create vendor lock-in. Other open source solutions also exist, but they have a steep learning curve and are daunting to customize and deploy.

We set out to build a free and open source implementation of WebRTC rooms that's easily embeddable within any app. LiveKit provides an opinionated, end-to-end real time communications solution with first-party SDKs for all the major software platforms.

Architecture

LiveKit is written in Go. It's made possible by Pion WebRTC, ion-sfu, and the amazing community behind them.

LiveKit is horizontally-scalable. You can run it on one node or 100, with an identical configuration. Nodes use peer-to-peer routing via Redis to ensure clients in the same room are connected to the same node.

LiveKit has no external dependencies when running in single-node. Redis is required for a distributed setup spanning multiple nodes.

LiveKit Architecture

Client Examples

TypeScript
import {
connect,
createLocalTracks,
Participant,
RoomEvent,
Track,
VideoTrack,
} from 'livekit-client'

const url = 'wss://your_host'
const token = 'jwt_token'

const room = await connect(url, token)

// set up listeners
room.on(RoomEvent.TrackSubscribed, (track, publication, participant) => {
attachTrack(track, participant)
})

const tracks = await createLocalTracks({
audio: true,
video: true,
})
for (let track of tracks) {
// publish to the room
const publication = await room.localParticipant.publishTrack(track)
// attach to DOM only if it's video
if (track instanceof VideoTrack) {
attachTrack(track, room.localParticipant)
}
}

function attachTrack(track: Track, participant: Participant) {
// creates a new audio or video element
const element = track.attach()
// find the target element for participant
...
target.appendChild(element)
}