Quickstart
Installing the packages:
You can install the Huddle01 Vanilla JS SDK packages in two ways:
The huddleClient
variable will be accessible in the global scope after importing from CDN.
-
Using the script tag: Add the following code snippet to the head of your HTML file: Replace with our CDN
<script src="https://unpkg.com/@huddle01/web-core@latest/dist/index.js" /> <script type="module"> huddleClient.initialize("YOUR_PROJECT_ID"); huddleClient.joinLobby("YOUR_ROOM_ID"); </script>
-
Using npm (or yarn): Run the following command in your terminal to install the package:
npm install @huddle01/web-core
Initializing the client:
After installing the package, you can initialize the client in your JavaScript code as shown below:
<script>
huddleClient.initialize("YOUR_PROJECT_ID");
document.getElementById('joinLobby').onclick = () => {
huddleClient.joinLobby('YOUR_ROOM_ID');
};
document.getElementById('joinRoom').onclick = () => {
huddleClient.joinRoom();
};
</script>