JavaScript Quickstart

Get started with LiveKit and JavaScript

tip:

Check out our dedicated quickstarts for React or Next.js if you're using one of those platforms.

1. Install LiveKit SDK

Install the LiveKit SDK:

yarn add livekit-client

2. Join a room

Note that this example hardcodes a token. In a real app, you’ll need your server to generate a token for you.

import { Room } from 'livekit-client';
const wsURL = "<your LiveKit server URL>"
const token = "<generate a token>"
const room = new Room();
await room.connect(wsURL, token);
console.log('connected to room', room.name);
// Publish local camera and mic tracks
await room.localParticipant.enableCameraAndMicrophone();

3. Next Steps

Happy coding!