• Docs
  • Getting Started
  • Add to Existing project

Add Huddle01 to an Existing Project


Huddle01 can be easily integrated to any existing project to leverage the infrastructure of our platform. This guide will walk you through the steps to add Huddle01 to your application. We provide you with client functions to build a robust and secure connection to the Huddle01 platform. The client functions are available in the client-methods section.

Prerequisites

You must have an API Key to access the Huddle01 Infrastructure.

Get your API Key here

You must have the latest version of Nodejs installed on your machine. You can download the latest version of Nodejs from here.

Dependencies

Install the huddle01-client package using the following command:

## npm
npm install --save @huddle01/huddle01-client
## yarn
yarn add @huddle01/huddle01-client

Usage

The huddleClient is the root class of the SDK. It is used to access all the fetaures of the SDK. To initialize the HuddleClient Class in your project getHuddleClient function provided inside the module must be used.

Replace Your-API-Key with the key generated here

//src/App.tsx
import { getHuddleClient } from '@huddle01/huddle01-client';
 
const huddleClient = getHuddleClient('Your-API-Key');

Note: The HuddleClient is a singleton class so you should only have one instance of it in your project. If you want to use the HuddleClient in multiple places in your project, you should import it from a single file. This will ensure that you are using the same instance of the HuddleClient everywhere.

Initialize the HuddleClient

To enable all the features of the SDK, You should wrap your project with the HuddleProvider component. The HuddleClientProvider is a wrapper component for the HuddleClient class. It is used to provide the HuddleClient instance to all the child components in the project.

//src/App.tsx
import { HuddleClientProvider, getHuddleClient } from '@huddle01/huddle01-client';
 
const App = () => {
  const huddleClient = getHuddleClient('<Your-API-Key>')
  return (
    <HuddleClientProvider client = {huddleClient} >
      <YourApp>
        ...
      </YourApp>
    </HuddleClientProvider>
  );
};

Note: The HuddleClientProvider should be the root component of your project. It should wrap all the other components in your project. You can use the HuddleClientProvider in any component in your project. But it is recommended that you use it in the root component of your project.

And that's it! You have successfully integrated the Huddle01 SDK to your project.

Using the HuddleClient

As mentioned above, the HuddleClient is the root class of the SDK. It exposes several methods to access the features of the SDK. For example, to join a room you can use the join method of the HuddleClient class.

huddleClient.join('roomId');

Next Steps

Now that you have successfully integrated the Huddle01 SDK to your project, you can start using the SDK to build your own features.

Check out Client Methods to learn more about how to invoke different HuddleClient methods to build your own features.