Skip to content

Getting Started

This is a JavaScript client library for accessing Omega APIs.

Installation

Include the latest version.

<script src="https://agent-sdk.omega.kklab.com/production/js/latest/omega-agent-sdk.js"></script>

For production, replace latest with the version number to load a specific version.

<script src="https://agent-sdk.omega.kklab.com/production/js/1.3/omega-agent-sdk.js"></script>

Usage

Create a new Omega instance to interact with server using WebSocket.

const { Config, Constants, Omega } = window['omega'];

// create a new Config instance
const config = new Config({
  appId: 'APP_ID',
  token: 'TOKEN',
});

(async () => {
  try {
    // create a new Omega instance
    const omega = new Omega(config);

    // connect to server
    await omega.connect();

    // interact with server
    await omega.ping();

    // disconnect from server
    omega.disconnect();
  } catch (error) {
    console.log(error);
  }
})();