@adapt-toolkit/broker
v0.9.7
Published
The ADAPT message broker — the relay wrappers connect through. Standalone server package: run `npx adapt-broker --host <h> --port <p>`, or embed via the Broker class. Split out of @adapt-toolkit/sdk so client installs don't carry server-only dependencies
Readme
@adapt-toolkit/broker
The ADAPT message broker — the relay that ADAPT wrappers connect through. The
broker sees ciphertext frames only: it authorizes registrations with a
challenge-response possession proof, routes frames by container id, and queues
messages for offline recipients (in memory, or durably in SQLite with
--db_path).
This is the server package. Client code (the wrapper, BrokerClient) lives
in @adapt-toolkit/sdk,
which carries no server-only dependencies.
Run
npx @adapt-toolkit/broker --host 0.0.0.0 --port 9000or install globally:
npm i -g @adapt-toolkit/broker
adapt-broker --host 0.0.0.0 --port 9000Useful flags:
| flag | meaning |
|------|---------|
| --host <h> / --port <p> | listen address (required) |
| --db_path <path> | persist queued messages for offline recipients in a SQLite file (loads the native better-sqlite3 module) |
| --test_mode | skip attestation checks (local development only) |
GET /info on the listen port serves live broker metrics (HTML dashboard, or
JSON with Accept: application/json).
Embed
import { Protocol } from '@adapt-toolkit/sdk/wrapper'
import { AdaptEnvironment } from '@adapt-toolkit/sdk/backend'
import { Broker, BrokerConfigurator } from '@adapt-toolkit/broker'
const config = new BrokerConfigurator()
config.process_arguments(['--host', '127.0.0.1', '--port', '9000'])
await AdaptEnvironment.InitializeAsync(false)
await Protocol.Initialize()
new Broker(config).start()Versioning
@adapt-toolkit/broker is version-locked to @adapt-toolkit/sdk: every
release bumps both to the same version, whether or not the broker itself
changed, and the broker pins that exact sdk version.
