Skip to content

SDK Initialization Example

The SDK can be used normally after the initialization is completed. The following is an example of SDK initialization code:

JavaScript
import { AXRobot, AppMode } from "@autoxing/robot-js-sdk";

// create an instance of AXRobot
const axRobot = new AXRobot("<appId>", "<appSecret>", AppMode.WAN_APP);

// Initialize the AXRobot instance
const successed = await axRobot.init();
if (successed) {
   // initialization successful
} else {
   // initialization failed
}

Parameter Description

Name Type Description
appId string the application ID, which can be applied to relevant operators
appSecret string data request key, which can be provided to relevant operators
AppMode string AppMode
serverUrl string Optional
If not provided, the service defaults to the China server endpoint
serverUrl:
China server endpoint: "https://api.autoxing.com/"
Global server endpoint: "https://apiglobal.autoxing.com/"
websocketUrl string Optional
If not provided, the service defaults to the China server endpoint
websocketUrl:
China server endpoint: "wss://service.autoxing.com/"
Global server endpoint: "wss://serviceglobal.autoxing.com/"

Example