Installation & Quick Start
The AxonKit client SDK is a JavaScript/TypeScript library for real-time communication, built on mediasoup-client with a LiveKit-compatible API surface.
Installation
Section titled “Installation”pnpm add @axonkit/client-sdk-jsQuick Start
Section titled “Quick Start”import { Room, RoomEvent, ConnectionState, setLogLevel, LogLevel,} from '@axonkit/client-sdk-js';
setLogLevel(LogLevel.INFO);
const room = new Room({ dynacast: true, // pause simulcast layers with no subscribers adaptiveStream: true, // adapt subscription quality to element size/visibility});
// Subscribe to events before connectingroom .on(RoomEvent.ParticipantConnected, (participant) => { console.log(`${participant.identity} joined`); }) .on(RoomEvent.ParticipantDisconnected, (participant) => { console.log(`${participant.identity} left`); }) .on(RoomEvent.TrackSubscribed, (track, publication, participant) => { const element = track.attach(); if (track.kind === 'video') { document.getElementById('remote-videos')?.appendChild(element); } else { element.play(); } });
// Connect with a JWT token; the room is taken from the token's room grantawait room.connect('https://your-server.com', 'your-jwt-token');
// Publish camera and microphoneawait room.localParticipant.setCameraEnabled(true);await room.localParticipant.setMicrophoneEnabled(true);
// Laterawait room.disconnect();Building from source
Section titled “Building from source”pnpm installpnpm buildOutputs:
dist/axonkit-client.esm.js— ES Moduledist/axonkit-client.umd.js— UMD (for<script>tags)dist/index.d.ts— TypeScript declarations
Open examples/demo/index.html in a browser after building. Requires a running
AxonKit server.
Full API reference
Section titled “Full API reference”See the API Reference for the complete type and method surface.