Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Install and connect

BxiClient is the entry point. It spawns or attaches to the C++ bridge, opens the transport, queries device capabilities, and exposes operations through its features member.

Install

npm install @anthriq_dev/bxi-interface
pip install anthriq-bxi-interface

Connect to a device

Connecting is two calls, in order. initialize() reaches the bridge; connect() reaches the device through it.

The only difference between devices is the device type string:

Your hardware
Device type

Instinct headset, xSys amplifier

anthriq-instinct

xBud

ni-usb-daq

import { BxiClient } from "@anthriq_dev/bxi-interface";

const client = new BxiClient<"anthriq-instinct">({
  deviceType: "anthriq-instinct",
  timeout: 30000,
});

await client.initialize("localhost");
await client.connect();
from anthriq_bxi_interface import BxiClient

client = BxiClient(device_type="anthriq-instinct", timeout=30000)

await client.initialize("localhost")
await client.connect()

Operations issued between the two calls fail with a device-not-connected error: the bridge is reachable, the device is not.

Address the device

initialize() accepts a bare host or a full WebSocket URL.

host value

Resulting URL

"localhost"

ws://localhost:9250

"192.168.1.100"

ws://192.168.1.100:9250

"ws://localhost:9250"

Used verbatim

"wss://device.local:9250"

Used verbatim

A bare host is expanded using the plugin's connection defaults, which are port 9250 for anthriq-instinct. Pass a full URL to reach an emulator or a non-standard port.

Devices announce themselves over mDNS with a hostname carrying the hardware variant, such as anthriq-instinct-xsys-v1-4FFD98.local. That name is a valid host:

Note: initialize() attaches to a running bridge daemon when it serves the same URL and respawns it when the URL differs. How the SDK talks to a device explains why that check exists.

Connect to several devices at once

Clients of the same device type share one daemon by default. Set instanceId to key the daemon per device, so each client gets its own process, PID file, and socket. This is what makes several xBud units work at once.

Warning: Use bridgeEnv rather than setting process environment variables. The process environment is shared, so on concurrent connects the second write reaches the bridge already spawned for the first client, and both end up pointed at one device.

bridgeEnv applies only when the client spawns a new bridge. Attaching to an existing daemon leaves its environment untouched.

Check the connection

Two flags distinguish the two hops. isInitialized() means the bridge answered and capabilities are known; isConnected() means the device link is open. A client can be initialized but not connected, which is exactly the window where operations fail with a device-not-connected error.

See Read device information.

Shut down

Disconnect from the device, then shut down. shutdown() disconnects first when the link is still open, so it is safe on its own.

shutdown() detaches from the bridge daemon rather than stopping it, since other clients may be attached. See How the SDK talks to a device.

Warning: Remove every stream before shutting down. A stream left registered keeps the device transmitting after the process exits. See Stream lifecycle.

Next steps

Last updated

Was this helpful?