Reference
Node SDK

Node SDK

This ProteusAI SDK aims to help the development of integrations with ProteusAI that use JavaScript, providing an easy interface to communicate with ProteusAI services.

Installation

To install the ProteusAI SDK, use npm or yarn:

npm install @proteus-ai/sdk

or

yarn add @proteus-ai/sdk

Usage

Importing the SDK

First, import the ProteusAI SDK into your project:

import ProteusAI from '@proteus-ai/sdk';

Initializing the SDK

Create an instance of the ProteusAI class by providing your API key and optional configuration options:

const proteus = new ProteusAI({
  apiKey: '' // get from your proteus AI account dashboard
});

Connecting to the Service

You can register a callback to be invoked when the connection is successful:

proteus.connected(() => {
  // You can be sure that the connection was successful inside this function.
  // Run events or emitters that need a guarantee or rely on a successful connection.
  console.log('Connected to ProteusAI');
});

Checking Connection Status

You can check if the service is connected or connecting:

if (proteus.isConnected) {
  console.log('ProteusAI is connected');
}
 
if (proteus.isConnecting) {
  console.log('ProteusAI is connecting');
}

Disconnecting from the Service

To disconnect from the ProteusAI service:

proteus.disconnect();
console.log('Disconnected from ProteusAI');

© 2024 ProteusAI. All rights reserved