Quickstart
💡
We have upgraded our SDK to v2 (2.x.x)
. For the previous stable release, please visit here
This guide will help you to quickly get started with using our Javascript SDK in your project.
Installation
You can install the Huddle01 Vanilla JS SDK packages in two ways:
Using the script tag (IIFE/UMD)
Add the following code snippet to the head of your HTML.
<script src="https://unpkg.com/@huddle01/web-core@umd/dist/index.global.js"></script>
<script>
let client;
// call this function in onclick of `join room` button
const init = async () => {
client = new HuddleWebCore.HuddleClient({
projectId: "YOUR_PROJECT_ID",
options: {
activeSpeakers: {
// Number of active speaker visible in the grid, by default 8
size: 10,
},
},
});
const room = await client.joinRoom({
roomId: "YOUR_ROOM_ID",
token: "YOUR_ACCESS_TOKEN",
});
};
</script>
Use npm or any other package manager (ESM/CommonJS)
Run the following command in your terminal to install the package:
npm install @huddle01/web-core
Using client to access Methods
Once you initialise huddleClient
you can access various methods such as joinRoom
and other methods.
You can generate roomId using this API and access token using our Server SDK.
import { HuddleClient } from '@huddle01/web-core';
const huddleClient = new HuddleClient({
projectId: "YOUR_PROJECT_ID"
})
// Call this in onclick on `join room` button.
huddleClient.joinRoom({
roomId: "YOUR_ROOM_ID",
token: "YOUR_ACCESS_TOKEN"
});