Skip to content

Autoblow JS SDK

This is a guide for the Autoblow JS SDK. This SDK is used to control the Autoblow devices in a node environment or in the browser.

Installation

Terminal window
npm install @xsense/autoblow-sdk

Usage

import { Autoblow } from "@xsense/autoblow-sdk";
const autoblow = new Autoblow();
//Initialize the device with your device token
await autoblow.init("jya6vksq08q3");
//Get the device information
const info = await autoblow.getInfo();
console.log("Device Info:", info);
//Get the device state
const state = await autoblow.getState();
console.log("Device State:", state);

SDK Reference

init(token: string): Promise<void>

Initialize the connection to the given device token.

getInfo(): Promise<DeviceInfo>

Returns the device information.

getState(): Promise<DeviceState>

Returns the device state.

getConnectedCluster: string | null

Returns the connected cluster string or null if not connected.

getConnectionInfo(token: string): Promise<DeviceConnection>

Returns the connection info for the given device token.

localScriptSet(localScriptIndex: number, speedIndex:number): Promise<DeviceState>

Sets the local script to the given index and to the given speed index.

localScriptStart(): Promise<DeviceState>

Starts the local script.

localScriptStop(): Promise<DeviceState>

Stops the local script.

oscillateSet(speed:number, minY: number, maxY:number): Promise<DeviceState>

Sets the oscillation speed and the oscillation range.

oscillateStart(): Promise<DeviceState>

Starts the oscillation.

oscillateStop(): Promise<DeviceState>

Stops the oscillation.

syncScriptLoadToken(token:string): Promise<DeviceState>

Loads the sync script with the given sync token.

syncScriptUploadFunscriptUrl(funscriptUrl: string): Promise<DeviceState>

Will download the funscript from the given url, convert it to a binary script that autoblow can play and upload it onto the device.

syncScriptUploadFunscriptFile(funscript: Funscript): Promise<DeviceState>

Will upload the given funscript onto the device. The funscript should be a Funscript object.

syncScriptUploadCsvUrl(csvUrl: string): Promise<DeviceState>

Will download the csv file from the given url, convert it to a binary script that autoblow can play and upload it onto the device.

syncScriptUploadCsvFile(csvContent: string): Promise<DeviceState>

Will upload the given csv script onto the device. The csv content should be a string.

syncScriptStart(): Promise<DeviceState>

Starts the sync script.

syncScriptStop(): Promise<DeviceState>

Stops the sync script.

syncScriptOffset(offsetTimeMs: number): Promise<DeviceState>

Sets the sync script offset time in milliseconds.

estimateLatency(noOfRequests?: number): Promise<number>

Estimates the latency of the device by sending a number of requests and calculating the average latency. If no number of requests is given, the default is 10.