# Getting started (/docs/client/getting-started)
## Install [#install]
The packages depend on how the radio is connected.
npm
pnpm
yarn
bun
```bash
npm install @meshcorejs/client serialport
```
```bash
pnpm add @meshcorejs/client serialport
```
```bash
yarn add @meshcorejs/client serialport
```
```bash
bun add @meshcorejs/client serialport
```
npm
pnpm
yarn
bun
```bash
npm install @meshcorejs/client
```
```bash
pnpm add @meshcorejs/client
```
```bash
yarn add @meshcorejs/client
```
```bash
bun add @meshcorejs/client
```
npm
pnpm
yarn
bun
```bash
npm install @meshcorejs/client @abandonware/noble
```
```bash
pnpm add @meshcorejs/client @abandonware/noble
```
```bash
yarn add @meshcorejs/client @abandonware/noble
```
```bash
bun add @meshcorejs/client @abandonware/noble
```
## A first bot [#a-first-bot]
Two files. `main.ts` connects to the radio, logs in and loads every brick found in the folders next to it.
`commands/hello.ts` is the first command.
```ts title="main.ts"
const serial = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }), // COM3 on Windows
load: import.meta.dirname,
});
```
```ts title="main.ts"
const tcp = new Client({
transport: new TcpTransport({ host: '192.168.1.50' }), // port 5000 unless the radio says otherwise
load: import.meta.dirname,
});
```
```ts title="main.ts"
const ble = new Client({
transport: new BleTransport({ name: 'ClubBot' }), // or { address: 'aa:bb:cc:dd:ee:ff' }
load: import.meta.dirname,
});
```
```ts title="commands/hello.ts"
import { CommandBuilder } from '@meshcorejs/client';
export default new CommandBuilder()
.setName('hello')
.setDescription('Say hello')
.setHandler((ctx) => ctx.reply(`Hello ${ctx.author.name}, I am ${ctx.client.self.name}`));
```
Send `/hello` to the bot in a DM. On a channel, send `@ClubBot hello`, with the name the radio advertises.
Every brick is one file with a default export, in a folder named after its kind. `commands/`, `events/`,
`jobs/`, `permissions/`, `roles/` and `plugins/` are scanned at login.
A radio message carries 160 UTF-8 bytes. The library refuses a message that does not fit with
`MessageTooLongError` instead of truncating it. See [Sending messages](./client/sending-messages).
## Next [#next]
* [Answer a command](./guides/answer-a-command), the first guide.
* [Bricks and loading](./client/bricks-and-loading) to organise a bot in folders.
* [Radio settings](./client/radio-settings) to declare the node's name and LoRa parameters.
## Reference [#reference]
* [Client](./reference/classes/Client)
* [CommandBuilder](./reference/classes/CommandBuilder)
* [SerialTransport](./reference/classes/SerialTransport)
* [TcpTransport](./reference/classes/TcpTransport)
* [BleTransport](./reference/classes/BleTransport)
# Overview (/docs/client)
`@meshcorejs/client` is the bot framework for [MeshCore](https://github.com/meshcore-dev/MeshCore) radios
running the **Companion Radio** firmware. A `Client` logs into the radio and keeps its contacts and channels
in cache. Everything the bot does is declared with builders, the way [discord.js](https://discord.js.org)
bots are. It is the only package a bot installs.
## Requirements [#requirements]
* A MeshCore node running the **Companion Radio** firmware, protocol version 3 or newer.
* Node.js 20 or newer to run bots.
* Serial needs `serialport`. BLE needs `@abandonware/noble`. TCP needs nothing.
## Where to start [#where-to-start]
## The other packages [#the-other-packages]
To contribute, read [`CONTRIBUTING.md`](https://github.com/meshcorejs/meshcore.js/blob/main/CONTRIBUTING.md) on GitHub.
# ai (/docs/plugins/ai)
Someone sends `/ask where is Toulouse` to the bot. The bot asks the model and answers in one or two
sentences.
## Install [#install]
npm
pnpm
yarn
bun
```bash
npm install @meshcorejs/plugin-ai
```
```bash
pnpm add @meshcorejs/plugin-ai
```
```bash
yarn add @meshcorejs/plugin-ai
```
```bash
bun add @meshcorejs/plugin-ai
```
## Configure [#configure]
```ts title="plugins/ai.ts"
import ai from '@meshcorejs/plugin-ai';
export default ai.configure({ apiKey: process.env.OPENAI_API_KEY ?? '' });
```
Another provider and French replies:
```ts title="plugins/ai.ts"
import { frenchReplies } from '@meshcorejs/plugin-ai';
export const openrouter = ai.configure({
apiKey: process.env.OPENROUTER_KEY ?? '',
baseURL: 'https://openrouter.ai/api/v1',
model: 'mistralai/mistral-small',
cooldown: 60,
replies: frenchReplies,
});
```
## On the air [#on-the-air]
`/ask ` in a DM, `@Bot ask ` on a channel. Everyone can ask, once every 30 seconds.
The model remembers the last six exchanges of each author for ten minutes, so a follow-up question works.
A long answer is split in two radio messages at most. When the model fails, the bot says
`⚠️ The assistant is unavailable, try again later` and nothing else.
`/ask` with no text at all is refused by the framework's own missing-argument reply, before the plugin
runs. The plugin's `empty` reply only answers a quoted empty question, such as `/ask ""`.
## Options [#options]
| Option | Default | Role |
| -------------- | ------------ | ------------------------------------------------------------ |
| `apiKey` | required | The provider's API key. Read it from your own environment. |
| `model` | `gpt-5-mini` | Model name. |
| `baseURL` | OpenAI | Base URL of an OpenAI-compatible provider. |
| `systemPrompt` | see below | Replaces the instruction. The bot's name is always appended. |
| `cooldown` | `30` | Seconds between two `/ask` by the same author. |
| `permission` | none | Permission required to ask. Without it everyone can. |
| `history` | `6` | Exchanges remembered per author. `0` disables memory. |
| `historyTtl` | `600` | Seconds before an author's memory is forgotten. |
| `maxParts` | `2` | Radio messages an answer may take, 1 to 3. |
| `replies` | English | `frenchReplies`, or a partial override. |
| `openai` | | Replaces the SDK client. For tests. |
Default instruction: `You answer over a LoRa radio. Reply in one or two short sentences, plain text, no
markdown, no lists.`
Without `baseURL`, the `openai` SDK still reads its own environment fallbacks, while the plugin itself
never reads `process.env`.
## Replies [#replies]
| Key | English |
| ------------- | -------------------------------------------------- |
| `unavailable` | `⚠️ The assistant is unavailable, try again later` |
| `empty` | `❓ Ask me something: /ask ` |
## Reference [#reference]
* [Source on GitHub](https://github.com/meshcorejs/meshcore.js/tree/main/plugins/ai)
* [npm](https://www.npmjs.com/package/@meshcorejs/plugin-ai)
# Overview (/docs/plugins)
An official plugin is an npm package under `@meshcorejs/plugin-*`. Add one to a bot with a single file.
```ts title="plugins/ai.ts"
import ai from '@meshcorejs/plugin-ai';
export default ai.configure({ apiKey: process.env.OPENAI_API_KEY ?? '' });
```
The file sits under `plugins/` and is loaded at login with the other bricks. Reload it from the radio with
`/plugins reload `.
Every official plugin follows the same rules. Secrets come from its options, read from your own
environment. Nothing is stored on disk. Every text it says on its own is English by default, French with
its `frenchReplies`, or yours.
To publish your own, see [Shipping a package](/docs/client/plugins/shipping-a-package).
# Overview (/docs/protocol)
Pure codec for the MeshCore Companion Radio protocol. It frames serial and TCP payloads, encodes the
commands the app sends to the radio, decodes the responses and pushes the radio sends back, and encodes
those same responses for `FakeRadio` to emulate a firmware.
The package has **no I/O and no runtime dependency**. Every function takes and returns `Uint8Array` or plain
objects; nothing opens a socket, a serial port or a BLE connection. Every byte layout comes from
`examples/companion_radio/MyMesh.cpp` in `meshcore-dev/MeshCore@0679dbe` (`FIRMWARE_VER_CODE 13`), the
firmware this library speaks.
## Who uses it [#who-uses-it]
* [`@meshcorejs/transports`](/docs/transports) wraps payloads with the serial/TCP framing and uses the
response/push encoders to build `FakeRadio`.
* [`@meshcorejs/client`](/docs/client) encodes every command it sends and decodes every frame a transport
emits.
* [`@meshcorejs/testing`](/docs/testing) re-exports the `FakeRadio` built on top of this codec.
Most bot code never imports `@meshcorejs/protocol` directly. The `Client` does the encoding and decoding.
Reach for it when writing a transport, an emulator, or a test that inspects raw frames.
## Reference [#reference]
* [Full reference](./reference)
# Overview (/docs/testing)
Lets bot authors test a whole bot without a radio: `createTestClient()` logs a real `Client` in on a
`FakeRadio` through a `MockTransport`, installs simulated time (`@sinonjs/fake-timers`), and offers
`dm()` / `channel()` helpers that return everything the bot put on the air. Re-exports the `/mock` tools of
`@meshcorejs/transports` for lower-level tests.
The [reference](./reference) lists `createTestClient()`, `TestBot` and `TestClientOptions`.
# Overview (/docs/transports)
Moves frame payloads between the app and a Companion radio behind one `Transport` interface:
`TcpTransport` (WiFi), `SerialTransport` (USB), `BleTransport`. The `@meshcorejs/transports/mock` subpath
ships `MockTransport` (in-memory) and `FakeRadio` (a firmware emulator) used by every test in the monorepo.
```ts
interface Transport extends TypedEmitter<{ frame: [Uint8Array]; close: [Error?] }> {
readonly kind: 'serial' | 'tcp' | 'ble' | 'mock';
readonly connected: boolean;
connect(signal?: AbortSignal): Promise;
write(payload: Uint8Array): Promise;
close(): Promise;
}
```
## What a transport does [#what-a-transport-does]
* Moves payloads: `write(payload)` sends one frame payload, `frame` events deliver one payload each.
* Adds and strips the framing for its medium (serial/TCP: `'<'`/`'>' | len u16 LE`; BLE: one write or
notification is already one frame, no header).
* Emits `close` only for an **unexpected** loss, never after the app itself called `close()`.
## What a transport does not do [#what-a-transport-does-not-do]
No reconnection, no protocol knowledge, no queueing of outgoing writes: the `Client` in
[`@meshcorejs/client`](/docs/client) owns all of that. A transport is a dumb pipe for bytes; everything
stateful about the bot's session lives one layer up.
## Reference [#reference]
* [Transport](./reference/main/interfaces/Transport)
* [TransportEvents](./reference/main/interfaces/TransportEvents)
* [TypedEmitter](./reference/main/classes/TypedEmitter)
# Bricks and loading (/docs/client/client/bricks-and-loading)
Everything a bot adds to a `Client` is a brick. Commands, events, jobs, permissions, roles and plugins are
declared with a builder, an object with chainable `set*` and `add*` methods. There is no plain-object
configuration and no other way to register one.
## The six bricks [#the-six-bricks]
| Brick | Builder | Declares |
| ---------- | ------------------- | ---------------------------------------------------------------------------------------- |
| Command | `CommandBuilder` | A `/name` command with typed arguments, a required permission, a cooldown and a handler. |
| Event | `EventBuilder` | A handler for one client event, run in registration order and isolated from the others. |
| Job | `JobBuilder` | A scheduled task, cron or interval, started when the client is ready. |
| Permission | `PermissionBuilder` | A named permission that commands and roles refer to. |
| Role | `RoleBuilder` | A priority, a set of permissions and members from a source you provide. |
| Plugin | `PluginBuilder` | A group of bricks that load, unload and reload together. |
## One file per brick [#one-file-per-brick]
The `load` option scans the folders next to `main.ts` at login. The layout is fixed and scanned in this
order, recursively.
```
permissions/
roles/
commands/
events/
jobs/
plugins/
```
Every `.ts`, `.js`, `.mjs` or `.mts` file is imported and its `export default` is registered. Skipped
are `.d.ts` files, `*.test.*` and `*.spec.*` files, and anything starting with `_`. The kind of a brick
comes from its builder, not from its folder. A brick in the wrong folder logs a warning and still loads.
```ts title="main.ts"
import { Client, RadioConfig, SerialTransport } from '@meshcorejs/client';
const bot = new Client({
transport: new SerialTransport({ path: process.env.MESH_SERIAL ?? '/dev/ttyACM0' }),
radio: new RadioConfig({ name: 'ClubBot' }),
load: import.meta.dirname,
});
await bot.login();
```
`load` accepts a path or a module URL. `import.meta.dirname` is the folder of the current file.
`client.load(dir)` does the same after construction, for a second folder or a folder chosen at runtime.
## register() [#register]
```ts title="main.ts"
import { CommandBuilder } from '@meshcorejs/client';
bot.register(
new CommandBuilder()
.setName('ping')
.setDescription('Check the bot is alive')
.setHandler((ctx) => ctx.reply('pong')),
);
```
`client.register()` takes one builder or a list and returns the client. It is the way to add a brick built
in code, for example from a configuration, or a plugin installed from npm. Bricks registered before `login()`
are validated with the loaded ones. After `ready`, `register()` loads them at once and reports a failure
through the `error` event instead of throwing.
## Hot reload [#hot-reload]
`client.load(dir, { watch: true })` keeps watching the folder. Changing a file reloads that file's bricks.
Changing a file under `plugins/` reloads the whole plugin. If the new version fails to build, the previous
brick stays registered and the failure is logged.
## Validation [#validation]
Every builder validates itself in `build()`. Problems are collected, not thrown one at a time, so one call
reports everything wrong in that brick. `login()` validates every registered brick in one pass and throws a
single `LoadError` listing every problem, so a bot never starts half-broken.
```
2 problem(s) in bot bricks:
commands/heard.ts › command "heard" › required argument "kind" after optional argument "hours"
commands/no-default.ts › export default › is not a meshcore.js builder
```
## Reference [#reference]
* [Brick](../reference/interfaces/Brick)
* [BrickKind](../reference/type-aliases/BrickKind)
* [isBrick](../reference/functions/isBrick)
* [LoadError](../reference/classes/LoadError)
* [LoadOptions](../reference/interfaces/LoadOptions)
# Errors and logging (/docs/client/client/errors-and-logging)
Only `login()`, `load()` and the plugin methods `load()`, `unload()` and `reload()` throw. Everywhere
else a failure is reported instead of thrown.
* A command handler that throws emits `commandError` and answers on the air with
`client.replies.internalError`.
* An event or job handler that throws emits `error` with `source.type` set to `event` or `job`.
* Without an `error` listener, the client logs the failure through `client.logger` instead of crashing.
```ts title="main.ts"
client.on('messageCreate', (message) => {
console.log(`${message.author.name}: ${message.content}`);
});
client.on('error', (error, source) => {
console.error(`[${source.type}${source.name ? ` ${source.name}` : ''}]`, error);
});
```
`source.type` is `command`, `event`, `job`, `plugin` or `internal`. `source.name` is the brick's
name when it has one.
## Error codes [#error-codes]
Every error the library throws is a `MeshcoreError` with a stable `code`.
| Class | `code` |
| -------------------------- | ----------------------- |
| `ClientStateError` | `INVALID_STATE` |
| `ConnectionError` | `CONNECTION_FAILED` |
| `UnsupportedFirmwareError` | `UNSUPPORTED_FIRMWARE` |
| `CommandTimeoutError` | `COMMAND_TIMEOUT` |
| `RadioError` | `RADIO_ERROR` |
| `RadioConfigError` | `RADIO_CONFIG_REJECTED` |
| `LimitReachedError` | `LIMIT_REACHED` |
| `MessageTooLongError` | `MESSAGE_TOO_LONG` |
| `DeliveryFailedError` | `DELIVERY_FAILED` |
| `LoadError` | `LOAD_FAILED` |
| `JobTimeoutError` | `JOB_TIMEOUT` |
| `MissingDependencyError` | `MISSING_DEPENDENCY` |
## Reference [#reference]
* [MeshcoreError](../reference/classes/MeshcoreError)
* [ErrorSource](../reference/interfaces/ErrorSource)
* [Logger](../reference/interfaces/Logger)
# Options and login (/docs/client/client/options-and-login)
`Client` is the entry point. It logs into a Companion radio over a `Transport`, keeps the contact and
channel caches, turns radio messages into `Message` objects, and runs the bricks you register. The
constructor takes infrastructure only. Everything the bot does comes from bricks, one file each, loaded
from the folders next to `main.ts`.
## Options [#options]
```ts title="main.ts"
import { Client, createConsoleLogger, SerialTransport } from '@meshcorejs/client';
const client = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }),
load: import.meta.dirname,
logger: createConsoleLogger(),
appName: 'ClubBot',
});
```
| Option | Role |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `transport` | Required. A `SerialTransport` (USB), `TcpTransport` (WiFi) or `BleTransport`. |
| `radio` | A `RadioConfig` applied at login. See [Radio settings](./radio-settings). |
| `replies` | A partial override of the texts the bot says on its own. See [Replies](../replies/overriding-texts). |
| `logger` | A `Logger`. Defaults to `createConsoleLogger()`. `silentLogger` disables logging. |
| `appName` | The name announced to the radio. Defaults to `meshcore.js`. |
| `load` | The folder scanned for bricks at login, usually `import.meta.dirname`. See [Bricks and loading](./bricks-and-loading). |
| `maxHops` | Bounds how far a message may have travelled for the bot to answer it. Integer ≥ 0; unset means no limit. See [A well-behaved bot](../guides/a-well-behaved-bot). |
## The login sequence [#the-login-sequence]
`login()` runs these steps in order and rejects if one fails.
1. Validate every registered brick. An invalid one throws a `LoadError`.
2. Connect the transport.
3. Announce `appName` and receive `client.self`.
4. Query the device and receive `client.device`. A firmware protocol version below 3 throws
`UnsupportedFirmwareError`.
5. Sync the radio's clock.
6. Apply the `radio` settings, if any.
7. Fetch the contacts into `client.contacts`.
8. Fetch the channels into `client.channels`.
9. Drain the messages the radio queued while the bot was offline. They arrive through `messageCreate` with
`message.backlog` set to `true`.
10. Start the jobs.
11. Emit `ready`.
Step 6 floods one advert when the name or location changed. That counts against the one-flood-per-30-minutes
limit (see [A well-behaved bot](../guides/a-well-behaved-bot)): if a flood already went out in the last 30
minutes, `login()` logs a warning and continues instead of failing.
## Caches and managers [#caches-and-managers]
| Property | Holds |
| ---------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| `client.contacts` | The contact cache. `get()` takes a public key or a prefix of 12 characters. |
| `client.channels` | The channel cache. `get()` takes a name or a slot index. |
| `client.self` | The radio's identity. Throws `ClientStateError` before login. |
| `client.device` | The radio's device info. Throws `ClientStateError` before login. |
| `client.commands`, `events`, `jobs`, `permissions`, `roles`, `plugins` | One manager per brick kind. |
| `client.radio` | Typed Companion commands. See [Radio settings](./radio-settings). |
Every cache is a `Collection`, a `Map` with `find`, `filter`, `map`, `some`, `every`, `first`,
`toArray` and `sorted` on top of `get`, `has` and `size`.
## Staying connected [#staying-connected]
Transports never reconnect on their own. The client does, with an exponential backoff from 1 second up to
60 seconds and unlimited attempts. It emits `disconnect` once when the link is lost and `reconnecting`
before every retry.
While connected, a health ping runs every 60 seconds. After two consecutive failures the client treats the
radio as disconnected and starts reconnecting.
After a reconnection the caches are reconciled with the radio. Only the differences emit their usual
events (`contactAdd`, `channelUpdate` and so on).
## Shutting down [#shutting-down]
```ts title="main.ts"
process.on('SIGINT', () => {
void client.destroy();
});
```
`destroy()` stops accepting new work, flushes the send queue for up to 5 seconds, stops the jobs and the
hot-reload watchers, and closes the transport.
## Reference [#reference]
* [Client](../reference/classes/Client)
* [ClientOptions](../reference/interfaces/ClientOptions)
* [Collection](../reference/classes/Collection)
# Radio settings (/docs/client/client/radio-settings)
The radio's identity and LoRa settings are declared once, as the `radio` option. `login()` compares them
with what the radio reports and applies only what differs.
## Declare once [#declare-once]
```ts title="main.ts"
import { Client, RadioConfig, RadioError, SerialTransport } from '@meshcorejs/client';
const client = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }),
radio: new RadioConfig({
name: 'TrainBot',
txPower: 22,
location: { lat: 43.6045, lon: 1.4442 },
params: { frequency: 869.525, bandwidth: 250, spreadingFactor: 11, codingRate: 5 },
}),
});
```
Fields use app units. `frequency` is in MHz, `bandwidth` in kHz, `txPower` in dBm, `location` in
decimal degrees. Every field is optional and an absent field is never touched. The instance is validated
and frozen at construction.
## What login() applies [#what-login-applies]
Right after the clock sync, the client diffs the declared settings against `client.self`.
* Only the fields you declared are compared, and only a field that differs is written.
* `txPower` is checked against the radio's maximum before anything is sent. A value above it fails
`login()` without touching the radio.
* After applying changes, the client announces itself again so `client.self` reflects the radio.
* If `name` or `location` changed, the client floods one advert so the mesh learns the new identity.
* `params` is written with the repeater flag only on firmware protocol version 9 and later.
## When the radio refuses [#when-the-radio-refuses]
A setting the radio rejects raises a `RadioConfigError` with the rejected `setting` and the radio's
`radioCode`. `login()` fails. During a reconnection the same error is retried with the rest of the
handshake.
## Changing settings at runtime [#changing-settings-at-runtime]
Past `login()`, the same settings can be changed through `client.radio`.
```ts title="main.ts"
try {
await client.radio.setTxPower(20);
} catch (error) {
if (error instanceof RangeError) console.error('invalid value:', error.message);
else if (error instanceof RadioError) console.error('radio refused it:', error.message);
else throw error;
}
```
`setAdvertName`, `setAdvertLatLon`, `setTxPower` and `setRadioParams` validate their input first. An
out-of-range value throws `RangeError` before any request is sent. A refusal by the radio rejects with
`RadioError`.
## Reference [#reference]
* [RadioConfig](../reference/classes/RadioConfig)
* [RadioConfigOptions](../reference/interfaces/RadioConfigOptions)
* [RadioConfigError](../reference/classes/RadioConfigError)
* [Radio](../reference/classes/Radio)
# Sending messages (/docs/client/client/sending-messages)
## Budgets in bytes [#budgets-in-bytes]
A radio message carries 160 UTF-8 bytes. A DM has a budget of 158 bytes. A channel message has 160 minus the
bytes of `: `, and minus the `@[author] ` mention when replying with one. A plain string over
budget throws `MessageTooLongError`. The library never truncates on its own.
## Ways to send [#ways-to-send]
`contact.send()`, `channel.send()`, `message.reply()` and `ctx.reply()` all accept a string or a
`MessageBuilder` and resolve to a `SentMessage` once queued.
```ts title="main.ts"
const contact = client.contacts.get('a1b2c3d4');
if (contact) await contact.send('back at the base by 18:00');
const channel = client.channels.get('general');
if (channel) await channel.send('weather updated for tomorrow');
client.on('messageCreate', async (message) => {
await message.reply('got it');
});
```
## MessageBuilder [#messagebuilder]
Builds a text that fits the budget from a title, lines, fields and a footer.
| Method | Effect |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `setTitle(text)` | First line. |
| `addLine(text)`, `addLines(texts)` | One line each. |
| `addField(name, value)` | Rendered as `name: value`, several to a line when they fit. |
| `setFooter(text)` | Last line. |
| `setOverflow(mode, { maxParts })` | `error` throws (default), `truncate` cuts to an ellipsis, `split` numbers up to `maxParts` parts (default 3). |
| `measure(budget)` | Bytes, limit and part count without sending. Defaults to the DM budget. |
| `build(budget)` | The parts that would be sent. |
Splitting never cuts inside a code point or an emoji sequence.
```ts title="main.ts"
const forecast = new MessageBuilder()
.setTitle('📍 Club site')
.addLine('Today 18°/24°, rain 10%')
.addField('Wind', '12 km/h NW')
.setFooter('Updated 08:00')
.setOverflow('split', { maxParts: 3 });
const { bytes, limit, parts } = forecast.measure();
console.log(`${bytes}/${limit} bytes, ${parts} part(s)`);
```
## The send queue [#the-send-queue]
`client.sendQueue` is the only path to the air. It paces transmissions 2 seconds apart and keeps the parts
of one message together. For a DM it waits for the radio's acknowledgement before moving on, with up to 3
resends, then a path reset and one flood retry, then the message fails. A channel send resolves as soon as
it is transmitted, since channels have no acknowledgement. A part still queued after 5 minutes is dropped
and the message fails.
## Delivery status [#delivery-status]
`SentMessage.status` is `queued`, `sent`, `delivered` or `failed`. `delivered()` resolves once every
part is confirmed, or sent on a channel. The client also emits `messageDelivered` and `messageFailed`.
```ts title="main.ts"
if (contact) {
const sent = await contact.send('on my way');
console.log(sent.status); // 'queued' | 'sent' | 'delivered' | 'failed'
await sent.delivered();
}
client.on('messageDelivered', (sent) => {
console.log(`delivered: ${sent.parts.join(' / ')}`);
});
client.on('messageFailed', (sent, error) => {
console.log(`delivery failed (${error.reason}): ${sent.parts.join(' / ')}`);
});
```
## Reference [#reference]
* [MessageBuilder](../reference/classes/MessageBuilder)
* [SentMessage](../reference/classes/SentMessage)
* [SendQueue](../reference/classes/SendQueue)
* [MessageTooLongError](../reference/classes/MessageTooLongError)
* [DeliveryFailedError](../reference/classes/DeliveryFailedError)
* [DM\_TEXT\_BUDGET](../reference/variables/DM_TEXT_BUDGET)
* [channelTextBudget](../reference/functions/channelTextBudget)
# Arguments (/docs/client/commands/arguments)
Each argument is declared with one method taking a builder callback.
| Method | Parsed type |
| --------------- | ------------------------------------------- |
| `addStringArg` | `string` |
| `addIntegerArg` | `number` |
| `addNumberArg` | `number` |
| `addBooleanArg` | `boolean` |
| `addChoiceArg` | The union given to `setChoices()` |
| `addContactArg` | A `Contact` resolved from the radio's table |
| `addRoleArg` | A `Role` resolved from the registered roles |
| `addChannelArg` | A `Channel` resolved from the radio's table |
```ts title="commands/forecast.ts"
export const forecast = new CommandBuilder()
.setName('forecast')
.setDescription('Weather forecast for a city')
.addStringArg((arg) => arg.setName('city').setDescription('City name').setDefault('here'))
.addIntegerArg((arg) => arg.setName('days').setDescription('Days ahead').setMin(1).setMax(5).setDefault(2))
.addChoiceArg((arg) => arg.setName('unit').setDescription('Temperature unit').setChoices('c', 'f').setDefault('c'))
.setHandler((ctx) => {
// ctx.args is inferred as { city: string; days: number; unit: 'c' | 'f' }
return ctx.reply(`${ctx.args.city}, ${ctx.args.days}d, °${ctx.args.unit.toUpperCase()}`);
});
```
## Rules [#rules]
These rules are checked at `build()`.
* Argument names are unique.
* A required argument cannot follow an optional one.
* `setDefault()` makes an argument optional.
* `setRest()` takes the rest of the line. String arguments only, last argument only.
Values are split on whitespace. Double quotes keep a value with spaces together.
## Usage errors [#usage-errors]
A missing, invalid or extra value never reaches the handler. The bot answers with `missingArgument`,
`invalidArgument` or `tooManyArguments` from `client.replies`, followed by the usage line.
`setUsageErrorHandler()` replaces that reply for one command.
## Reference [#reference]
* [ArgBuilder](../reference/classes/ArgBuilder)
* [ArgumentError](../reference/classes/ArgumentError)
# Built-in commands (/docs/client/commands/built-in-commands)
Every `Client` registers three commands. They are ordinary commands built with an internal `core` flag, so
they never collide with yours, and they are listed last in the helper.
## /help [#help]
A bare `/` or `/help` in a DM, a bare `@Bot` or `@Bot help` on a channel, list the commands the author
can use, filtered by scope and, in a DM, by the author's permissions. A channel listing only shows commands
that need no permission. In a DM the answer is one usage line per command, split into up to three parts when
it is long; on a channel it is a single line with the command names (`helperChannel`), trimmed to fit the
budget.
## /plugins [#plugins]
`/plugins` lists every plugin with its state and brick count. `/plugins load|unload|reload ` acts
on one. It needs `Permissions.ManagePlugins` and only works in a DM. A `LoadError` from a reload is
summarised on the air with its first issue.
## /jobs [#jobs]
`/jobs` lists every job with its state and next run. `/jobs run|pause|resume ` acts on one. It
needs `Permissions.ManageJobs` and only works in a DM.
## Unlocking them [#unlocking-them]
Both commands exist in every bot, but nobody can pass their permission check without a role. A bot without
roles exposes nothing extra. An owner role with `Permissions.Administrator` unlocks both.
```ts title="roles/owner.ts"
export default new RoleBuilder()
.setName('owner')
.setDescription('Bot owners')
.setPriority(1000)
.addPermissions(Permissions.Administrator)
.setMembers(['a1b2c3d4e5f6']);
```
## Reference [#reference]
* [Permissions](../reference/variables/Permissions)
* [Command](../reference/classes/Command)
* [CORE\_PERMISSION\_PREFIX](../reference/variables/CORE_PERMISSION_PREFIX)
# Context and pipeline (/docs/client/commands/context-and-pipeline)
## The context [#the-context]
The handler receives a `CommandContext`.
| Member | Role |
| ------------------------- | ------------------------------------------------------------------------------ |
| `ctx.message` | The triggering `Message`. |
| `ctx.author` | Its author. |
| `ctx.args` | The parsed arguments, typed from the builder. |
| `ctx.reply(content)` | Answers where the command was triggered. Takes a string or a `MessageBuilder`. |
| `ctx.replyDM(content)` | Answers in a DM. Rejects when a channel author cannot be verified. |
| `ctx.can(permission)` | Whether the author holds a permission. |
| `ctx.canManageRole(role)` | Whether the author ranks above that role. |
| `ctx.canManageContact(c)` | Whether the author ranks above that contact. |
## The pipeline [#the-pipeline]
Every message that matches the trigger rule goes through these steps in order.
1. Trigger. Does it match a registered name or alias?
2. Max hops. Is the message within `client.maxHops`, if one is set?
3. Scope. Is the command allowed in this DM or channel?
4. Age. Is a backlog message too old?
5. Permissions. Does the author hold every required permission?
6. Cooldown. Did the author run this command too recently?
7. Arguments. Do the values match the declaration?
8. Handler.
Every refusal emits `commandDenied` with a typed `DenyReason`. A message from beyond `maxHops` is denied
silently with `{ type: 'tooFar', hopCount }`, before the helper branch runs — so an out-of-range `@Bot` gets
nothing either. On a channel every refusal is silent — the bot only speaks to answer a command it actually
ran. In a DM the others answer with a text from `client.replies`.
## When the handler throws [#when-the-handler-throws]
The client emits `commandError` and answers with `client.replies.internalError`. The error's detail never
goes on the air. `setErrorHandler()` replaces that reply for one command.
## Reference [#reference]
* [CommandContext](../reference/classes/CommandContext)
* [DenyReason](../reference/type-aliases/DenyReason)
* [DeniedContext](../reference/interfaces/DeniedContext)
# Declaring a command (/docs/client/commands/declaring-a-command)
## The trigger rule [#the-trigger-rule]
In a DM the trigger is `/name`, with no space after the slash. `@Bot name` is tolerated there too. On a
channel the trigger is `@Bot name`, with the name the radio advertises, case-insensitive, never `/`. This
rule is fixed. Every meshcore.js bot behaves the same and there is no option to change it.
Anything else in a message is not a command and only produces `messageCreate`.
## The builder [#the-builder]
Chain `setName`, `setDescription`, the optional `addAliases`, the arguments, then `setHandler`.
`build()` runs when the client validates its bricks and throws a `LoadError` listing every problem at
once. An invalid name, a duplicate alias or a missing handler are all reported together.
```ts title="commands/heard.ts"
export default new CommandBuilder()
.setName('heard')
.setDescription('Nodes heard in the last hour')
.addAliases('who')
.setHandler((ctx) => ctx.reply(`${ctx.client.contacts.cache.size} contacts on the radio`));
```
The file sits under `commands/` and exports the builder. See [Bricks and loading](../client/bricks-and-loading).
## Where and how often [#where-and-how-often]
| Method | Effect |
| --------------------------- | ------------------------------------------------------------------------------------------------------- |
| `setScope('dm', 'channel')` | Where the command can be triggered. Both by default. |
| `setRequiredPermissions()` | Permissions the author needs, all of them. Always refused on a channel, whatever the scope. |
| `setCooldown(seconds)` | Delay between two runs by the same author. `0` by default. |
| `setMaxAge(seconds)` | Messages queued on the radio while the bot was offline and older than this are ignored. 300 by default. |
## Reserved names [#reserved-names]
`help`, `plugins` and `jobs` belong to the [built-in commands](./built-in-commands). Declaring a command
or an alias with one of these names fails `build()`.
## Reference [#reference]
* [CommandBuilder](../reference/classes/CommandBuilder)
* [Command](../reference/classes/Command)
* [CommandScope](../reference/type-aliases/CommandScope)
# Events you can listen to (/docs/client/events/events-you-can-listen-to)
| Event | When | Arguments |
| ------------------ | ------------------------------------------------- | ---------------------------------------------------------- |
| `ready` | `login()` finished the handshake | |
| `disconnect` | The connection to the radio was lost | `error?: Error` |
| `reconnecting` | A reconnection attempt is about to run | `attempt: number, delayMs: number` |
| `error` | A handler, event, job or plugin failed | `error: Error, source: ErrorSource` |
| `messageCreate` | A DM or channel message was received | `message: Message` |
| `messageDelivered` | A DM was acknowledged by the recipient | `sent: SentMessage` |
| `messageFailed` | A DM could not be delivered | `sent: SentMessage, error: DeliveryFailedError` |
| `advert` | An advert was heard from a node | `advert: Advert` |
| `contactAdd` | A new contact appeared in the radio's table | `contact: Contact` |
| `contactUpdate` | An existing contact changed | `oldContact: Contact, newContact: Contact` |
| `contactRemove` | A contact was removed | `contact: Contact` |
| `contactsFull` | The radio's contact table has no free slot | |
| `channelUpdate` | A channel slot changed | `oldChannel: Channel \| null, newChannel: Channel \| null` |
| `commandRun` | A command handler ran | `ctx: CommandContext` |
| `commandError` | A command handler threw | `error: Error, ctx: CommandContext` |
| `commandDenied` | A command was refused before its handler | `ctx: DeniedContext, reason: DenyReason` |
| `pluginLoad` | A plugin finished loading | `plugin: Plugin` |
| `pluginUnload` | A plugin was unloaded | `plugin: Plugin` |
| `raw` | Every decoded frame from the radio, for debugging | `frame: DecodedFrame` |
`client.on()` and an `EventBuilder` receive the same arguments. The builder's handler gets the client
first.
## Reference [#reference]
* [ClientEvents](../reference/interfaces/ClientEvents)
* [ErrorSource](../reference/interfaces/ErrorSource)
# Handlers and isolation (/docs/client/events/handlers-and-isolation)
An `EventBuilder` picks one of the client's events with `setEvent()`. The name is checked against
`ClientEvents`, so the handler's extra arguments are typed to match. A `contactAdd` handler receives a
`Contact`, a `messageCreate` handler a `Message`.
```ts title="events/ready.ts"
export default new EventBuilder()
.setEvent('ready')
.setOnce()
.setHandler((client) => {
console.log(`${client.self.name} is ready`);
});
```
`setOnce()` runs the handler once and removes it. Without it the handler keeps running.
An event is a file under `events/` with the builder as default export, loaded at login like any brick.
## Order and isolation [#order-and-isolation]
Handlers of the same event run in registration order. One that throws or rejects is reported through the
`error` event with `source.type` set to `event` and `source.name` set to the event's name. The others
still run.
```ts title="events/welcome.ts, events/log.ts"
export const welcome = new EventBuilder().setEvent('contactAdd').setHandler((_client, contact) => {
throw new Error(`could not welcome ${contact.name}`);
});
export const log = new EventBuilder().setEvent('contactAdd').setHandler((_client, contact) => {
console.log(`still runs for ${contact.name}`);
});
```
```ts title="main.ts"
client.on('error', (error, source) => {
if (source.type === 'event') console.error(`event "${source.name}" failed:`, error);
});
```
## Reference [#reference]
* [EventBuilder](../reference/classes/EventBuilder)
* [EventManager](../reference/classes/EventManager)
# A well-behaved bot (/docs/client/guides/a-well-behaved-bot)
A channel message is a **flood** packet: every repeater that hears it relays it, whether it can read the channel
or not. Each reply your bot sends on a channel costs airtime to the whole mesh, and Public is the one channel
everybody listens to. meshcore.js enforces five rules so a bot cannot spam by accident.
## The five rules [#the-five-rules]
1. **A bot never speaks first on Public**, and only answers the commands you explicitly allowed there, one by
one, with `setScope('public')`. `channel.send()` and `message.reply()` on Public reject with `PublicChannelError`.
2. **On a channel, the bot only speaks to answer a command it ran.** Unknown command, cooldown, missing
permission, bad argument: silent (you still get `commandDenied`). In DM, refusals are answered as before.
3. **At most 10 messages per 5 minutes on one channel.** Beyond that `channel.send()` / `ctx.reply()` reject with
`RateLimitError` — nothing is queued. DMs are not limited: they are routed, acknowledged and already bounded.
4. **One flood advert per 30 minutes** (`client.radio.sendSelfAdvert(true)`). Zero-hop adverts are free.
5. **You can bound how far your bot answers**: `new Client({ maxHops: 2 })` ignores commands and refuses
`message.reply()` beyond two hops (`Message.hopCount`, `Message.tooFar`).
These limits stop accidental spam (a runaway job, refusals in a loop, restarts) and remove every easy path.
They do not stop a determined actor: the code is open and a raw frame can be hand-built. Nothing in the API
justifies going around them — if you need a Companion command the library does not wrap, use
`client.radio.request()`, never write to `client.transport` yourself.
## Answer on Public, deliberately [#answer-on-public-deliberately]
```ts
import { CommandBuilder } from '@meshcorejs/client';
export default new CommandBuilder()
.setName('info')
.setDescription('What this bot does')
.setScope('public') // Public only; add 'dm', 'channel' for more
.setHandler((ctx) => ctx.reply('WeatherBot · DM me /help'));
```
`@Bot` alone on Public lists only the commands that allow `'public'`; with none, the bot stays silent.
## Prefer DMs for personal answers [#prefer-dms-for-personal-answers]
A DM to a known contact is routed, not flooded. When the answer only concerns the author, use `ctx.replyDM()`
(the author must be a contact) and keep the channel reply to one short line — or none.
## Live on a regional channel [#live-on-a-regional-channel]
Hashtag channels derive their key from their name: anyone who knows `#fr-occ` can join. Put your bot's
commands on the channel of the people it serves rather than on Public. That chooses *who reads* the bot;
the rules above bound *what it transmits*.
## What you get when a limit hits [#what-you-get-when-a-limit-hits]
| Situation | Error / event |
| ----------------------------------------------- | ------------------------------------------------------------------------- |
| `channel.send()` or `message.reply()` on Public | `PublicChannelError` (`PUBLIC_CHANNEL`) |
| 11th part on a channel within 5 min | `RateLimitError` (`RATE_LIMIT`, `resource: 'channel'`, `retryAfterMs`) |
| Second flood advert within 30 min | `RateLimitError` (`resource: 'advert'`) |
| Reply to a message beyond `maxHops` | `TooFarError` (`TOO_FAR`); command → `commandDenied` `{ type: 'tooFar' }` |
| `radio.request()` with a transmitting command | `GuardedCommandError` (`GUARDED_COMMAND`) |
A command handler that lets `RateLimitError` escape does not get the usual `internalError` reply (it would be
refused too): the error is logged and `commandError` is emitted.
## Go further [#go-further]
* [Restrict who can run a command](./restrict-a-command) for scopes and permissions.
* [Post on a channel](./post-on-a-channel) for the send budgets and the per-channel limit.
* [Options and login](../client/options-and-login) for `maxHops` and the login flood advert.
# Answer a command (/docs/client/guides/answer-a-command)
Someone sends `/heard` to the bot. The bot answers with the nodes it heard in the last hour.
```ts title="commands/heard.ts"
export default new CommandBuilder()
.setName('heard')
.setDescription('Nodes heard in the last hour')
.setHandler((ctx) => {
const since = Date.now() - 3_600_000;
const heard = ctx.client.contacts.cache.filter((contact) => contact.lastSeen.getTime() > since);
return ctx.reply(
new MessageBuilder()
.setTitle(`📡 ${heard.size} heard`)
.addLines(heard.toArray().map((contact) => contact.name))
.setOverflow('truncate'),
);
});
```
```ts title="main.ts"
import { Client, SerialTransport } from '@meshcorejs/client';
const client = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }),
load: import.meta.dirname,
});
await client.login();
```
## What happens [#what-happens]
The file is picked up at login because it sits in `commands/` and exports the builder. A missing name or
handler stops the bot at startup with a clear message instead of failing later on the air.
In a DM the trigger is `/heard`. On a channel it is `@ClubBot heard`, with the name the radio advertises.
This rule is the same for every bot and cannot be changed.
`ctx.reply()` answers where the command came from. The `MessageBuilder` keeps the answer under the 160-byte
limit of a radio message and cuts the list when it is too long.
## Go further [#go-further]
* [Declaring a command](../commands/declaring-a-command) for aliases, scope and the reserved names.
* [Read the arguments](./read-the-arguments) to take input from the person.
* [Sending messages](../client/sending-messages) for the byte budgets and the send queue.
* [CommandBuilder](../reference/classes/CommandBuilder) in the reference.
# Post on a channel (/docs/client/guides/post-on-a-channel)
`/announce Meeting at the clubhouse, 19:00` in a DM posts the text on the `#club` channel.
```ts title="commands/announce.ts"
export default new CommandBuilder()
.setName('announce')
.setDescription('Post on the club channel')
.addStringArg((arg) => arg.setName('text').setRequired().setRest())
.setHandler(async (ctx) => {
const channel = ctx.client.channels.get('#club');
if (!channel) return ctx.reply('#club is not on the radio');
await channel.send(new MessageBuilder().setTitle('📣 Announcement').addLine(ctx.args.text).setOverflow('split'));
return ctx.reply('Posted');
});
```
## What happens [#what-happens]
`client.channels.get()` finds a channel by name or by slot index in the radio's table. The bot answers
if the channel is missing instead of failing.
`channel.send()` accepts a string or a `MessageBuilder`. A plain string over the budget throws
`MessageTooLongError`. The builder with `setOverflow('split')` sends up to three numbered parts instead.
The message goes through the send queue. Transmissions are two seconds apart and the parts of one message
stay together.
A channel accepts at most **10 messages per 5 minutes**; beyond that `channel.send()` rejects with
`RateLimitError`, nothing is queued. Sending on the **Public** channel is refused outright with
`PublicChannelError` — see [A well-behaved bot](./a-well-behaved-bot).
## Go further [#go-further]
* [Sending messages](../client/sending-messages) for the budgets, the builder and delivery status.
* [Restrict a command](./restrict-a-command) so only owners can announce.
* [A well-behaved bot](./a-well-behaved-bot) for the channel rate limit and Public.
* [MessageBuilder](../reference/classes/MessageBuilder) in the reference.
# React to the mesh (/docs/client/guides/react-to-the-mesh)
A new contact appears in the radio's table. The bot sends it a welcome message.
```ts title="events/welcome.ts"
export default new EventBuilder().setEvent('contactAdd').setHandler(async (_client, contact) => {
if (contact.type === 'chat') await contact.send('👋 Welcome to the club mesh. Send /help to see what I can do');
});
```
```ts title="events/heard.ts"
export const heard = new EventBuilder().setEvent('advert').setHandler((client, advert) => {
client.logger.info(`heard ${advert.name}${advert.contact ? '' : ' (not in contacts)'}`);
});
```
## What happens [#what-happens]
Files under `events/` are loaded at login. `setEvent()` picks one of the client's events. The handler's arguments are typed from it. A
`contactAdd` handler receives a `Contact`, an `advert` handler an `Advert`.
Handlers of the same event run in registration order. One that throws is reported through the `error`
event and does not stop the others.
`setOnce()` runs the handler a single time, for example on `ready`.
## Go further [#go-further]
* [Events you can listen to](../events/events-you-can-listen-to) for the full list.
* [Handlers and isolation](../events/handlers-and-isolation) for order and error handling.
* [EventBuilder](../reference/classes/EventBuilder) in the reference.
# Read the arguments (/docs/client/guides/read-the-arguments)
`/heard 6 repeater` lists the repeaters heard in the last six hours. Both values are optional and have a
default.
```ts title="commands/heard.ts"
export default new CommandBuilder()
.setName('heard')
.setDescription('Nodes heard recently')
.addIntegerArg((arg) => arg.setName('hours').setDescription('How far back').setMin(1).setMax(48).setDefault(1))
.addChoiceArg((arg) =>
arg.setName('kind').setDescription('Node kind').setChoices('chat', 'repeater').setDefault('chat'),
)
.setHandler((ctx) => {
// ctx.args is { hours: number; kind: 'chat' | 'repeater' }
const since = Date.now() - ctx.args.hours * 3_600_000;
const heard = ctx.client.contacts.cache.filter(
(contact) => contact.type === ctx.args.kind && contact.lastSeen.getTime() > since,
);
return ctx.reply(`${heard.size} ${ctx.args.kind} nodes in the last ${ctx.args.hours}h`);
});
```
## What happens [#what-happens]
Each `add*Arg` call declares one argument. `ctx.args` is typed from these calls, so `hours` is a
`number` and `kind` is `'chat' | 'repeater'` without a cast.
A value outside the range, or a kind that is not in the list, never reaches the handler. The bot answers
with the usage line instead.
Values are split on spaces. Double quotes keep a value with spaces together. A string argument with
`setRest()` takes the rest of the line.
## Go further [#go-further]
* [Arguments](../commands/arguments) for the eight argument types and their rules.
* [Context and pipeline](../commands/context-and-pipeline) for what runs before the handler.
* [ArgBuilder](../reference/classes/ArgBuilder) in the reference.
# Restrict who can run a command (/docs/client/guides/restrict-a-command)
Only the owners can post on the channel. Everyone else gets a polite refusal.
```ts title="roles/owner.ts"
export const owner = new RoleBuilder()
.setName('owner')
.setDescription('Bot owners')
.setPriority(1000)
.addPermissions(Permissions.Administrator)
.setMembers((process.env.OWNER_KEYS ?? '').split(',').filter(Boolean));
```
```ts title="commands/announce.ts"
export default new CommandBuilder()
.setName('announce')
.setDescription('Post on the club channel')
.addStringArg((arg) => arg.setName('text').setRequired().setRest())
.setRequiredPermissions(Permissions.Administrator)
.setHandler(async (ctx) => {
await ctx.client.channels.get('#club')?.send(ctx.args.text);
return ctx.reply('Posted');
});
```
## What happens [#what-happens]
The role lives under `roles/`, the command under `commands/`. A role has a priority, permissions and members. Members are public keys, or key prefixes of twelve
characters or more. The bot never stores them. They come from your own source, here an environment
variable.
`setRequiredPermissions()` on the command is checked before the handler runs. Without the permission the
person gets `Permission denied`.
A channel author cannot be verified. A command with a required permission is refused on a channel, silently —
no reply on the air, only `commandDenied` with `channelUntrusted`. Run it in a DM instead. See
[Channels are untrusted](../permissions/channels-are-untrusted) for why.
## Scopes [#scopes]
`setScope()` takes one or more of `'dm' | 'channel' | 'public'` — where the command may be triggered. It
defaults to `'dm'` and `'channel'`: the firmware's Public channel is never included unless a command opts in
explicitly, `setScope('public')` (alongside the others if it should answer everywhere). See
[A well-behaved bot](./a-well-behaved-bot) for why Public is opt-in and what else the framework refuses by
default.
## Go further [#go-further]
* [Model and built-in permissions](../permissions/model-and-built-in-permissions) for `Permissions.*`.
* [Roles and members](../permissions/roles-and-members) for member sources and hierarchy.
* [A well-behaved bot](./a-well-behaved-bot) for scopes, rate limits and `maxHops`.
* [RoleBuilder](../reference/classes/RoleBuilder) in the reference.
# Run something on a schedule (/docs/client/guides/run-on-a-schedule)
Every six hours the bot floods an advert, so the mesh keeps a route to it. Every evening at eight it posts
how many nodes it heard.
```ts title="jobs/advert.ts"
export default new JobBuilder()
.setName('advert')
.setInterval(6 * 3600)
.setRunOnStart()
.setHandler((client) => client.radio.sendSelfAdvert(true));
```
```ts title="jobs/evening-report.ts"
export const evening = new JobBuilder()
.setName('evening-report')
.setCron('0 20 * * *', { timezone: 'Europe/Paris' })
.setHandler(async (client) => {
const today = Date.now() - 86_400_000;
const heard = client.contacts.cache.filter((contact) => contact.lastSeen.getTime() > today).size;
await client.channels.get('#club')?.send(`📡 ${heard} nodes heard today`);
});
```
## What happens [#what-happens]
A job takes either `setInterval(seconds)` or `setCron(expression, { timezone })`. Files under `jobs/` are
loaded at login. Jobs start when the bot becomes ready and stop with `destroy()`.
`setRunOnStart()` also runs the job once at startup. A scheduled run is skipped while the radio is
disconnected.
A handler that throws is reported through the `error` event and the job keeps its schedule. From a DM,
`/jobs run|pause|resume ` controls it.
## Go further [#go-further]
* [Schedules and options](../jobs/schedules-and-options) for overlap, timeout and connection rules.
* [Built-in commands](../commands/built-in-commands) for `/jobs`.
* [JobBuilder](../reference/classes/JobBuilder) in the reference.
# Test without a radio (/docs/client/guides/test-without-a-radio)
The owner announces, the bot posts. A stranger tries, the bot refuses. Both checked in a test, without a
radio.
```ts title="announce.test.ts"
import { createTestClient } from '@meshcorejs/testing';
import { afterEach, expect, it } from 'vitest';
const bots: Array<{ destroy(): Promise }> = [];
afterEach(async () => {
await Promise.all(bots.map((bot) => bot.destroy()));
});
it('lets an owner post on the channel', async () => {
const bot = await createTestClient({ load: import.meta.dirname, now: '2026-09-20T18:00:00Z' });
bots.push(bot);
const alice = bot.fakeContact('Alice');
bot.fakeChannel('#club');
bot.setRoleMembers('owner', [alice]);
expect(await bot.dm(alice, '/announce Meeting at 19:00')).toEqual(['Posted']);
expect(bot.sentTo('#club')).toEqual(['Meeting at 19:00']);
});
it('refuses everyone else', async () => {
const bot = await createTestClient({ load: import.meta.dirname });
bots.push(bot);
expect(await bot.dm(bot.fakeContact('Bob'), '/announce free beer')).toEqual(['⛔ Permission denied']);
});
```
## What happens [#what-happens]
`createTestClient()` logs a real `Client` in on a `FakeRadio` and loads the bricks of a folder.
`fakeContact()` and `fakeChannel()` fill the radio's tables.
`dm()` sends a message as a contact and returns what the bot answered. `sentTo()` returns what the bot
put on a channel.
Time is simulated. `advanceTime('6h')` fires the jobs due in between. `destroy()` releases everything.
## Go further [#go-further]
* [@meshcorejs/testing](/docs/testing) for the package and its reference.
* [TestBot](/docs/testing/reference/interfaces/TestBot) for every helper.
# Translate the replies (/docs/client/guides/translate-the-replies)
The bot refuses a command, asks for a DM, lists the plugins. All these texts are English by default and
come from one place.
```ts title="main.ts"
const client = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }),
replies: frenchReplies,
});
```
```ts title="main.ts"
const club = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }),
replies: {
...frenchReplies,
unknownCommandDM: '❓ Commande inconnue, essaie /help',
cooldown: (seconds) => `⏳ Encore ${seconds}s`,
},
});
```
## What happens [#what-happens]
`replies` takes a partial object. Only the keys you give replace the default. `frenchReplies` is a
complete set, so spreading it first and overriding after works too.
Function entries keep their parameters, like `cooldown(seconds)`.
Command names stay English. `help`, `plugins`, `jobs` and their actions are not translated.
## Go further [#go-further]
* [Overriding texts](../replies/overriding-texts) for the rules.
* [All replies](../replies/all-replies) for every key and its default.
* [Replies](../reference/interfaces/Replies) in the reference.
# Write a plugin (/docs/client/guides/write-a-plugin)
A poll on the channel and a vote in DM. Both share the same state, so they live in one plugin.
```ts title="polls-plugin.ts"
export const polls = new PluginBuilder<{ channel: string }>()
.setName('polls')
.setDescription('One yes/no poll at a time')
.setBricks((client, { channel }) => {
const votes = new Map();
return [
new CommandBuilder()
.setName('poll')
.setDescription('Open a poll on the channel')
.addStringArg((arg) => arg.setName('question').setRequired().setRest())
.setHandler(async (ctx) => {
votes.clear();
await client.channels.get(channel)?.send(`📊 ${ctx.args.question} (/vote yes|no)`);
}),
new CommandBuilder()
.setName('vote')
.setDescription('Vote on the open poll')
.addChoiceArg((arg) => arg.setName('answer').setChoices('yes', 'no').setRequired())
.setHandler((ctx) => {
votes.set(ctx.author.name, ctx.args.answer);
return ctx.reply(`${votes.size} votes so far`);
}),
];
});
```
```ts title="plugins/polls.ts"
export default polls.configure({ channel: '#club' });
```
## What happens [#what-happens]
`setBricks()` is a factory. It runs when the plugin loads and on every reload, with the client and the
options. State kept in its closure is reset on reload.
`configure()` returns a copy carrying the options. The file under `plugins/` exports that copy, and the
loader registers it. The same plugin can be configured twice with two names.
`/plugins reload polls` from a DM rebuilds the bricks. If the new version fails, the previous bricks keep
running.
## A Companion command without a wrapper [#a-companion-command-without-a-wrapper]
`client.radio` only wraps the commands the library needs internally. For anything else, go through
`client.radio.request(code, payload?, collect?)` — never write frames to `client.transport` yourself, it
bypasses the one-request-in-flight queue. `CommandCode` is not re-exported by `@meshcorejs/client`; import it
from `@meshcorejs/protocol`.
```ts
import { CommandCode } from '@meshcorejs/protocol';
import { expectType } from '@meshcorejs/client';
const { epochSeconds } = await client.radio.request(
CommandCode.GetDeviceTime,
undefined,
expectType('currentTime', (f) => f),
);
```
The three transmitting commands the library knows (`SendTxtMsg`, `SendChannelTxtMsg`, `SendSelfAdvert`) are
refused with `GuardedCommandError`: use `channel.send()`, `contact.send()` or `client.radio.sendSelfAdvert()`
instead — the guarded surfaces that go through the send queue, carrying whichever limits apply (DMs aren't
rate-limited). See [A well-behaved bot](./a-well-behaved-bot).
## Go further [#go-further]
* [Writing one](../plugins/writing-one) for static bricks and validation.
* [Configuring and runtime](../plugins/configuring-and-runtime) for load, unload and reload.
* [Shipping a package](../plugins/shipping-a-package) to publish it on npm.
* [A well-behaved bot](./a-well-behaved-bot) for the guarded commands and the anti-spam limits.
# Lifecycle and errors (/docs/client/jobs/lifecycle-and-errors)
Jobs start together when the client becomes ready and stop with `client.destroy()`. A job registered
after `ready`, for example by a plugin loaded at runtime, starts at once.
`client.jobs.get(name)` returns the running `Job`. `run()` triggers it now, following the overlap policy.
`pause()` and `resume()` stop and restart its schedule. `nextRun`, `lastRun` and `running` report its
state.
```ts title="main.ts"
const healthCheck = client.jobs.get('health-check');
await healthCheck?.run();
healthCheck?.pause();
healthCheck?.resume();
console.log(healthCheck?.nextRun, healthCheck?.lastRun, healthCheck?.running);
```
From a DM, `/jobs run|pause|resume ` does the same for anyone holding `Permissions.ManageJobs`.
## Errors and timeouts [#errors-and-timeouts]
A handler that throws, rejects or times out is reported through the `error` event with `source.type` set
to `job` and `source.name` set to the job's name. The job keeps its schedule.
```ts title="main.ts"
client.on('error', (error, source) => {
if (source.type === 'job') console.error(`job "${source.name}" failed:`, error);
});
```
## Reference [#reference]
* [Job](../reference/classes/Job)
* [JobManager](../reference/classes/JobManager)
* [JobTimeoutError](../reference/classes/JobTimeoutError)
# Schedules and options (/docs/client/jobs/schedules-and-options)
A `JobBuilder` runs its handler on a schedule. `setCron(expression, { timezone })` takes a cron expression,
parsed by [croner](https://github.com/hexagon/croner), with an optional IANA timezone. `setInterval(seconds)`
takes a delay between runs. Exactly one of the two is required.
```ts title="jobs/bulletin.ts"
import { JobBuilder, MessageBuilder } from '@meshcorejs/client';
import { config } from '../config.js';
import { weather } from '../weather.js';
export default new JobBuilder()
.setName('bulletin')
.setCron('0 7 * * *', { timezone: config.timezone })
.setOverlap('skip')
.setTimeout(60)
.setHandler(async (client) => {
const channel = client.channels.get(config.channel);
if (!channel) return client.logger.warn(`bulletin: channel ${config.channel} is not on the radio`);
const [today, tomorrow] = await weather.forecast(2);
const lines = [];
if (today) lines.push(`Today ${weather.format(today)}`);
if (tomorrow) lines.push(`Tomorrow ${weather.format(tomorrow)}`);
await channel.send(new MessageBuilder().setTitle('🌄 Good morning').addLines(lines).setOverflow('truncate'));
});
```
## Options [#options]
| Method | Effect |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `setRunOnStart()` | Also runs the job once when it starts. Off by default. |
| `setOverlap('skip' \| 'queue')` | What happens when a run is due while the previous one is still going. `skip` drops it (default), `queue` runs it right after. |
| `setTimeout(seconds)` | Aborts the run past that delay. The handler's `signal` is aborted with a `JobTimeoutError`. `0` disables it (default). |
| `setRequiresConnection(bool)` | Skips a scheduled run while the radio is disconnected. On by default. A manual `run()` always runs. |
```ts title="jobs/health-check.ts"
export default new JobBuilder()
.setName('health-check')
.setInterval(300)
.setRunOnStart()
.setOverlap('queue')
.setTimeout(30)
.setRequiresConnection(false)
.setHandler(async (client, job) => {
if (job.signal.aborted) return;
client.logger.info(`last run: ${job.lastRun?.toISOString() ?? 'never'}`);
});
```
## Reference [#reference]
* [JobBuilder](../reference/classes/JobBuilder)
* [JobRunInfo](../reference/interfaces/JobRunInfo)
* [JobSchedule](../reference/type-aliases/JobSchedule)
# Channels are untrusted (/docs/client/permissions/channels-are-untrusted)
A channel message carries a sender name in plain text and nothing that proves it. Anyone can write any name.
A command with `setRequiredPermissions()` is therefore always refused on a channel, whatever its scope.
The role check never runs. The refusal is silent: `commandDenied` fires with `channelUntrusted`, but the bot
says nothing on the air — on a channel every refusal is silent, only a DM gets an answer from
`client.replies`. Send the command in a DM instead, where the sender is a verified contact.
The same rule applies to the built-in helper. On a channel its one line (`helperChannel`) only lists the
commands that need no permission.
`ctx.author.verified` tells a handler which case it is in. `ctx.replyDM()` rejects for an unverified
author.
## Reference [#reference]
* [Author](../reference/type-aliases/Author)
* [UnverifiedAuthor](../reference/interfaces/UnverifiedAuthor)
# Model and built-in permissions (/docs/client/permissions/model-and-built-in-permissions)
Permissions come only from roles. A `Role` has a priority, a list of permissions and a member source. The
library never stores membership. You own it, in a `.env` list, a database or a config file, and hand it to
`setMembers()`.
## Built-in permissions [#built-in-permissions]
`Permissions.*` are ready-made permissions named `core.*`. The `core.` prefix is reserved for them.
| Permission | Unlocks |
| ----------------------------- | ----------------------------------------------- |
| `Permissions.Administrator` | Every permission |
| `Permissions.ManageRoles` | Give and remove roles, limited by the hierarchy |
| `Permissions.ManageContacts` | Add, remove and edit radio contacts |
| `Permissions.ManageChannels` | Create and delete radio channels |
| `Permissions.ManageJobs` | Run, pause and resume jobs |
| `Permissions.ManagePlugins` | Load, unload and reload plugins |
| `Permissions.ViewPermissions` | See who has which role |
One role granting `Permissions.Administrator` is enough to unlock the built-in `/plugins` and `/jobs`
commands and any command you protect with it.
```ts title="roles/owner.ts"
import { Client, Permissions, RoleBuilder, SerialTransport } from '@meshcorejs/client';
const client = new Client({ transport: new SerialTransport({ path: '/dev/ttyACM0' }) });
client.register(
new RoleBuilder()
.setName('owner')
.setDescription('Bot owners')
.setPriority(1000)
.addPermissions(Permissions.Administrator)
.setMembers((process.env.OWNER_KEYS ?? '').split(',').filter(Boolean)),
);
```
## Your own permissions [#your-own-permissions]
For anything beyond the built-ins, declare a `PermissionBuilder`, grant it to a role, and require it on a
command.
```ts title="main.ts"
import { CommandBuilder, PermissionBuilder } from '@meshcorejs/client';
const trainAlert = new PermissionBuilder().setName('train.alert').setDescription('Broadcast a traffic alert');
client.register([
trainAlert,
new RoleBuilder()
.setName('alerts')
.setPriority(20)
.addPermissions(trainAlert)
.setMembers(moderatorKeys, { cacheTtl: 60 }),
new CommandBuilder()
.setName('alert')
.setDescription('Broadcast a traffic alert')
.addStringArg((arg) => arg.setName('text').setRequired().setRest())
.setRequiredPermissions(trainAlert)
.setHandler(async (ctx) => {
const channel = ctx.client.channels.get('#lyon');
if (!channel) return ctx.reply('Channel #lyon is not on the radio');
await channel.send(ctx.args.text);
await ctx.reply('Broadcast sent');
}),
]);
```
## Reference [#reference]
* [PermissionBuilder](../reference/classes/PermissionBuilder)
* [Permissions](../reference/variables/Permissions)
* [PermissionManager](../reference/classes/PermissionManager)
# Roles and members (/docs/client/permissions/roles-and-members)
## Members [#members]
Members are public keys, full or as a prefix of 12 hexadecimal characters or more, optionally with a label.
`setMembers()` takes a list, or a function returning one, sync or async, with an optional cache.
After members change in your own source, call `invalidate()` on the registered role so the next check
picks it up.
```ts title="main.ts"
async function moderatorKeys(): Promise {
return []; // query your own storage
}
client.register(new RoleBuilder().setName('moderator').setPriority(10).setMembers(moderatorKeys, { cacheTtl: 60 }));
// after moderators change in your own storage
client.roles.get('moderator')?.invalidate();
```
## Hierarchy [#hierarchy]
* `setPriority(n)` is a unique integer. A higher number ranks above.
* `client.permissions.rank(author)` is the highest priority among the author's roles.
* `canManageRole(author, role)` holds when the author ranks above the role.
* `canManageContact(author, target)` holds when the author ranks above the target.
* `whoHas(permission)` lists every member holding it, directly or through `Administrator`, with their
`Contact` when the radio knows them.
There is no exception for `Administrator`. An owner cannot manage a role of equal or higher priority.
## Reference [#reference]
* [RoleBuilder](../reference/classes/RoleBuilder)
* [Role](../reference/classes/Role)
* [RoleManager](../reference/classes/RoleManager)
* [MemberSource](../reference/type-aliases/MemberSource)
# Configuring and runtime (/docs/client/plugins/configuring-and-runtime)
## Configuring [#configuring]
`PluginBuilder` is exported unconfigured. `configure(options)` returns a copy carrying the
options, so the original export stays reusable. Nothing runs when `configure()` is called. The factory sees
the options at load time.
`weather-bot` shares one `WeatherService` between the plugin and the rest of the bot by passing it through
the options.
```ts title="weather.ts"
import { config } from './config.js';
import { WeatherService } from './weather-plugin/index.js';
export const weather = new WeatherService({ location: config.location, timezone: config.timezone });
```
```ts title="plugins/weather.ts"
import { weather } from '../weather.js';
import weatherPlugin from '../weather-plugin/index.js';
export default weatherPlugin.configure({ weather });
```
## Runtime [#runtime]
```ts title="main.ts"
import { Client, SerialTransport } from '@meshcorejs/client';
const client = new Client({ transport: new SerialTransport({ path: '/dev/ttyACM0' }) });
client.on('pluginLoad', (plugin) => console.log(`${plugin.name} loaded (${plugin.bricks.length} bricks)`));
client.on('pluginUnload', (plugin) => console.log(`${plugin.name} unloaded`));
client.on('error', (error, source) => {
if (source.type === 'plugin') console.error(`plugin "${source.name}" failed:`, error);
});
await client.login();
const weather = client.plugins.get('weather');
console.log(weather?.state); // 'pending' | 'loaded' | 'unloaded'
await weather?.unload();
await weather?.load();
await weather?.reload();
```
Plugins found under `plugins/` are `pending` until `login()` loads them, before connecting and emitting
`ready`. After `ready`, a file added to a watched folder or a `client.register()` call loads a new plugin at
once. A failure is reported
through `error` with `source.type` set to `plugin` and the plugin stays unloaded.
`reload()` rebuilds the bricks. On failure it puts the previous ones back, so the plugin keeps running with
its old bricks. From a DM, `/plugins load|unload|reload ` does the same.
## Reference [#reference]
* [Plugin](../reference/classes/Plugin)
* [PluginManager](../reference/classes/PluginManager)
* [PluginState](../reference/type-aliases/PluginState)
# Shipping a package (/docs/client/plugins/shipping-a-package)
Export the unconfigured `PluginBuilder` as the package's default export. If the plugin needs a service,
export its class next to it, as `weather-plugin/index.ts` does with `WeatherService`.
A bot installs the package, creates the service itself, and exports `plugin.configure({ ... })` from a file
under `plugins/`. Several files, each with its own `setName()`, run the same plugin with different options
side by side.
Tag the repository with the `meshcorejs-plugin` topic on GitHub so people find it.
## Reference [#reference]
* [PluginBuilder](../reference/classes/PluginBuilder)
# Writing one (/docs/client/plugins/writing-one)
A plugin is a named group of bricks that load, unload and reload as one unit. It is the sixth brick and the
only unit of dynamism in the library. To unload or reload a set of bricks at runtime, put them in a plugin.
## The factory [#the-factory]
`setBricks((client, options) => [...])` runs when the plugin loads and on every `reload()`, never at
construction. It returns the bricks. `addBricks(...)` is the static equivalent for a fixed list.
```ts title="weather-plugin/index.ts"
import { CommandBuilder, MessageBuilder, PluginBuilder } from '@meshcorejs/client';
export interface WeatherOptions {
location: { lat: number; lon: number };
timezone?: string;
fetch?: typeof fetch;
}
export interface Place {
name: string;
lat: number;
lon: number;
}
export interface DayForecast {
date: string;
min: number;
max: number;
rain: number;
icon: string;
}
interface OpenMeteoDaily {
daily: {
time: string[];
temperature_2m_max: number[];
temperature_2m_min: number[];
precipitation_probability_max: number[];
weather_code: number[];
};
}
export function weatherIcon(code: number): string {
if (code === 0) return '☀️';
if (code <= 2) return '🌤';
if (code === 3) return '☁️';
if (code <= 48) return '🌫';
if (code <= 67) return '🌧';
if (code <= 77) return '❄️';
if (code <= 82) return '🌦';
return '⛈';
}
export class WeatherService {
readonly #options: WeatherOptions;
constructor(options: WeatherOptions) {
if (!Number.isFinite(options.location.lat) || !Number.isFinite(options.location.lon)) {
throw new RangeError('WeatherService: location.lat and location.lon are required');
}
this.#options = options;
}
async locate(name: string): Promise {
const { fetch: doFetch = fetch } = this.#options;
const url = new URL('https://geocoding-api.open-meteo.com/v1/search');
url.searchParams.set('name', name);
url.searchParams.set('count', '1');
const response = await doFetch(url);
if (!response.ok) throw new Error(`Open-Meteo geocoding answered ${response.status}`);
const { results } = (await response.json()) as {
results?: { name: string; latitude: number; longitude: number }[];
};
const first = results?.[0];
return first ? { name: first.name, lat: first.latitude, lon: first.longitude } : null;
}
async forecast(days = 3, place?: Pick): Promise {
const { timezone, fetch: doFetch = fetch } = this.#options;
const location = place ?? this.#options.location;
const url = new URL('https://api.open-meteo.com/v1/forecast');
url.searchParams.set('latitude', String(location.lat));
url.searchParams.set('longitude', String(location.lon));
url.searchParams.set('daily', 'temperature_2m_max,temperature_2m_min,precipitation_probability_max,weather_code');
url.searchParams.set('timezone', timezone ?? 'UTC');
url.searchParams.set('forecast_days', String(days));
const response = await doFetch(url);
if (!response.ok) throw new Error(`Open-Meteo answered ${response.status}`);
const { daily } = (await response.json()) as OpenMeteoDaily;
return daily.time.slice(0, days).map((date, i) => ({
date,
min: Math.round(daily.temperature_2m_min[i] ?? 0),
max: Math.round(daily.temperature_2m_max[i] ?? 0),
rain: daily.precipitation_probability_max[i] ?? 0,
icon: weatherIcon(daily.weather_code[i] ?? 0),
}));
}
format(day: DayForecast): string {
return `${day.icon} ${day.min}°/${day.max}°, rain ${day.rain}%`;
}
}
export interface WeatherPluginOptions {
weather: WeatherService;
}
export default new PluginBuilder()
.setName('weather')
.setDescription('Forecast for the club location')
.setBricks((_client, { weather }) => [
new CommandBuilder()
.setName('weather')
.setDescription('Two-day forecast, at the club or in a city')
.addStringArg((arg) => arg.setName('city').setRest())
.setCooldown(30)
.setHandler(async (ctx) => {
const place = ctx.args.city ? await weather.locate(ctx.args.city) : null;
if (ctx.args.city && !place) return ctx.reply(`❓ Unknown city "${ctx.args.city}"`);
const [today, tomorrow] = await weather.forecast(2, place ?? undefined);
const lines = [];
if (today) lines.push(`Today ${weather.format(today)}`);
if (tomorrow) lines.push(`Tomorrow ${weather.format(tomorrow)}`);
await ctx.reply(
new MessageBuilder()
.setTitle(place ? `📍 ${place.name}` : '📍 Here')
.addLines(lines)
.setOverflow('truncate'),
);
}),
]);
```
## Validation [#validation]
The plugin's bricks are validated when the plugin loads. Problems are prefixed with the plugin's name, for
example `weather › options: configure() is missing`.
## Reference [#reference]
* [PluginBuilder](../reference/classes/PluginBuilder)
* [PluginDefinition](../reference/interfaces/PluginDefinition)
* [PluginBricksFactory](../reference/type-aliases/PluginBricksFactory)
# @meshcorejs/client (/docs/client/reference)
## Classes [#classes]
* [ArgBuilder](./classes/ArgBuilder.md)
* [ArgumentError](./classes/ArgumentError.md)
* [BleTransport](./classes/BleTransport.md)
* [Channel](./classes/Channel.md)
* [ChannelManager](./classes/ChannelManager.md)
* [Client](./classes/Client.md)
* [ClientStateError](./classes/ClientStateError.md)
* [Collection](./classes/Collection.md)
* [Command](./classes/Command.md)
* [CommandBuilder](./classes/CommandBuilder.md)
* [CommandContext](./classes/CommandContext.md)
* [CommandManager](./classes/CommandManager.md)
* [CommandTimeoutError](./classes/CommandTimeoutError.md)
* [ConnectionError](./classes/ConnectionError.md)
* [Contact](./classes/Contact.md)
* [ContactManager](./classes/ContactManager.md)
* [DeliveryFailedError](./classes/DeliveryFailedError.md)
* [EventBuilder](./classes/EventBuilder.md)
* [EventManager](./classes/EventManager.md)
* [GuardedCommandError](./classes/GuardedCommandError.md)
* [Job](./classes/Job.md)
* [JobBuilder](./classes/JobBuilder.md)
* [JobManager](./classes/JobManager.md)
* [JobTimeoutError](./classes/JobTimeoutError.md)
* [LimitReachedError](./classes/LimitReachedError.md)
* [LoadError](./classes/LoadError.md)
* [MeshcoreError](./classes/MeshcoreError.md)
* [Message](./classes/Message.md)
* [MessageBuilder](./classes/MessageBuilder.md)
* [MessageTooLongError](./classes/MessageTooLongError.md)
* [MissingDependencyError](./classes/MissingDependencyError.md)
* [PermissionBuilder](./classes/PermissionBuilder.md)
* [PermissionManager](./classes/PermissionManager.md)
* [Plugin](./classes/Plugin.md)
* [PluginBuilder](./classes/PluginBuilder.md)
* [PluginManager](./classes/PluginManager.md)
* [PublicChannelError](./classes/PublicChannelError.md)
* [Radio](./classes/Radio.md)
* [RadioConfig](./classes/RadioConfig.md)
* [RadioConfigError](./classes/RadioConfigError.md)
* [RadioError](./classes/RadioError.md)
* [RateLimitError](./classes/RateLimitError.md)
* [Role](./classes/Role.md)
* [RoleBuilder](./classes/RoleBuilder.md)
* [RoleManager](./classes/RoleManager.md)
* [SendQueue](./classes/SendQueue.md)
* [SentMessage](./classes/SentMessage.md)
* [SerialTransport](./classes/SerialTransport.md)
* [TcpTransport](./classes/TcpTransport.md)
* [TooFarError](./classes/TooFarError.md)
* [TypedEmitter](./classes/TypedEmitter.md)
* [UnsupportedFirmwareError](./classes/UnsupportedFirmwareError.md)
## Interfaces [#interfaces]
* [Advert](./interfaces/Advert.md)
* [ArgDefinition](./interfaces/ArgDefinition.md)
* [BleTransportOptions](./interfaces/BleTransportOptions.md)
* [Brick](./interfaces/Brick.md)
* [ChannelRecord](./interfaces/ChannelRecord.md)
* [ClientEvents](./interfaces/ClientEvents.md)
* [ClientOptions](./interfaces/ClientOptions.md)
* [CommandDefinition](./interfaces/CommandDefinition.md)
* [ContactRecord](./interfaces/ContactRecord.md)
* [CreateChannelOptions](./interfaces/CreateChannelOptions.md)
* [DeniedContext](./interfaces/DeniedContext.md)
* [DeviceInfo](./interfaces/DeviceInfo.md)
* [ErrorSource](./interfaces/ErrorSource.md)
* [EventDefinition](./interfaces/EventDefinition.md)
* [JobDefinition](./interfaces/JobDefinition.md)
* [JobRunInfo](./interfaces/JobRunInfo.md)
* [LoadIssue](./interfaces/LoadIssue.md)
* [LoadOptions](./interfaces/LoadOptions.md)
* [Location](./interfaces/Location.md)
* [Logger](./interfaces/Logger.md)
* [Member](./interfaces/Member.md)
* [MessageData](./interfaces/MessageData.md)
* [Path](./interfaces/Path.md)
* [Permission](./interfaces/Permission.md)
* [PermissionDefinition](./interfaces/PermissionDefinition.md)
* [PermissionHolder](./interfaces/PermissionHolder.md)
* [PluginDefinition](./interfaces/PluginDefinition.md)
* [RadioConfigOptions](./interfaces/RadioConfigOptions.md)
* [RadioEvents](./interfaces/RadioEvents.md)
* [RadioOptions](./interfaces/RadioOptions.md)
* [RadioParams](./interfaces/RadioParams.md)
* [Replies](./interfaces/Replies.md)
* [ResolvedMember](./interfaces/ResolvedMember.md)
* [RoleDefinition](./interfaces/RoleDefinition.md)
* [SelfInfo](./interfaces/SelfInfo.md)
* [SendOptions](./interfaces/SendOptions.md)
* [SerialTransportOptions](./interfaces/SerialTransportOptions.md)
* [TcpTransportOptions](./interfaces/TcpTransportOptions.md)
* [Transport](./interfaces/Transport.md)
* [UnverifiedAuthor](./interfaces/UnverifiedAuthor.md)
## Type Aliases [#type-aliases]
* [ArgType](./type-aliases/ArgType.md)
* [ArgValue](./type-aliases/ArgValue.md)
* [Author](./type-aliases/Author.md)
* [BrickKind](./type-aliases/BrickKind.md)
* [ClientStatus](./type-aliases/ClientStatus.md)
* [Collector](./type-aliases/Collector.md)
* [CommandErrorHandler](./type-aliases/CommandErrorHandler.md)
* [CommandHandler](./type-aliases/CommandHandler.md)
* [CommandScope](./type-aliases/CommandScope.md)
* [ContactKind](./type-aliases/ContactKind.md)
* [DecodedFrame](./type-aliases/DecodedFrame.md)
* [DeliveryFailureReason](./type-aliases/DeliveryFailureReason.md)
* [DenyReason](./type-aliases/DenyReason.md)
* [EventName](./type-aliases/EventName.md)
* [JobSchedule](./type-aliases/JobSchedule.md)
* [LogLevel](./type-aliases/LogLevel.md)
* [MemberInput](./type-aliases/MemberInput.md)
* [MemberList](./type-aliases/MemberList.md)
* [MemberSource](./type-aliases/MemberSource.md)
* [MessageContent](./type-aliases/MessageContent.md)
* [OverflowMode](./type-aliases/OverflowMode.md)
* [OverlapPolicy](./type-aliases/OverlapPolicy.md)
* [PermissionLike](./type-aliases/PermissionLike.md)
* [PluginBricksFactory](./type-aliases/PluginBricksFactory.md)
* [PluginState](./type-aliases/PluginState.md)
* [RadioSetting](./type-aliases/RadioSetting.md)
* [RateLimitedResource](./type-aliases/RateLimitedResource.md)
* [SentMessageStatus](./type-aliases/SentMessageStatus.md)
* [UsageErrorHandler](./type-aliases/UsageErrorHandler.md)
## Variables [#variables]
* [ADVERT\_FLOOD\_INTERVAL\_MS](./variables/ADVERT_FLOOD_INTERVAL_MS.md)
* [CHANNEL\_SEND\_LIMIT](./variables/CHANNEL_SEND_LIMIT.md)
* [CHANNEL\_SEND\_WINDOW\_MS](./variables/CHANNEL_SEND_WINDOW_MS.md)
* [CORE\_PERMISSION\_PREFIX](./variables/CORE_PERMISSION_PREFIX.md)
* [DEFAULT\_MAX\_PARTS](./variables/DEFAULT_MAX_PARTS.md)
* [DESTROY\_FLUSH\_TIMEOUT\_MS](./variables/DESTROY_FLUSH_TIMEOUT_MS.md)
* [DM\_MAX\_RESENDS](./variables/DM_MAX_RESENDS.md)
* [DM\_TEXT\_BUDGET](./variables/DM_TEXT_BUDGET.md)
* [englishReplies](./variables/englishReplies.md)
* [frenchReplies](./variables/frenchReplies.md)
* [HEALTH\_CHECK\_INTERVAL\_MS](./variables/HEALTH_CHECK_INTERVAL_MS.md)
* [HEALTH\_CHECK\_MAX\_FAILURES](./variables/HEALTH_CHECK_MAX_FAILURES.md)
* [Permissions](./variables/Permissions.md)
* [RECONNECT\_BASE\_DELAY\_MS](./variables/RECONNECT_BASE_DELAY_MS.md)
* [RECONNECT\_MAX\_DELAY\_MS](./variables/RECONNECT_MAX_DELAY_MS.md)
* [Replies](./variables/Replies.md)
* [SEND\_EXPIRY\_MS](./variables/SEND_EXPIRY_MS.md)
* [SEND\_INTERVAL\_MS](./variables/SEND_INTERVAL_MS.md)
* [silentLogger](./variables/silentLogger.md)
## Functions [#functions]
* [channelTextBudget](./functions/channelTextBudget.md)
* [createConsoleLogger](./functions/createConsoleLogger.md)
* [expectType](./functions/expectType.md)
* [hashtagChannelSecret](./functions/hashtagChannelSecret.md)
* [isBrick](./functions/isBrick.md)
* [mergeReplies](./functions/mergeReplies.md)
# All replies (/docs/client/replies/all-replies)
| Key | English default |
| --------------------------------- | ------------------------------------------------------------------------------------------- |
| `unknownCommandDM` | `❓ Unknown command, /help` |
| `noCommands` | `No commands available` |
| `internalError` | `❌ Internal error` |
| `missingPermissions` | `⛔ Permission denied` |
| `cooldown(seconds)` | `⏳ Try again in ${seconds}s` |
| `invalidArgument(name, usage)` | `⚠️ ${name} is invalid\n${usage}` |
| `missingArgument(name, usage)` | `⚠️ ${name} is missing\n${usage}` |
| `tooManyArguments(usage)` | `⚠️ too many arguments\n${usage}` |
| `usage(usage)` | `⚠️ usage\n${usage}` |
| `helperChannel(names)` | `Commands: ${names.join(', ')} · DM me /help` |
| `noPlugins` | `No plugins` |
| `pluginLine(name, loaded, count)` | `${name} ✅ ${count}` when loaded, `${name} ⏸️` when unloaded |
| `pluginLoaded(name, count)` | `✅ ${name} loaded (${count})` |
| `pluginReloaded(name, count)` | `✅ ${name} reloaded (${count})` |
| `pluginUnloaded(name)` | `⏸️ ${name} unloaded` |
| `pluginAlreadyLoaded(name)` | `ℹ️ ${name} is already loaded` |
| `pluginAlreadyUnloaded(name)` | `ℹ️ ${name} is already unloaded` |
| `pluginFailed(name, issue)` | `❌ ${name}: ${issue}` |
| `unknownPlugin` | `❓ Unknown plugin` |
| `noJobs` | `No jobs` |
| `jobLine(name, state, nextRun)` | `${name} ▶️ ${nextRun}` when scheduled, `${name} ⏸️` when paused, `${name} 🔄` when running |
| `jobStarted(name)` | `▶️ ${name} started` |
| `jobAlreadyRunning(name)` | `ℹ️ ${name} is already running` |
| `jobPaused(name)` | `⏸️ ${name} paused` |
| `jobResumed(name)` | `▶️ ${name} resumed` |
| `jobAlreadyPaused(name)` | `ℹ️ ${name} is already paused` |
| `jobNotPaused(name)` | `ℹ️ ${name} is not paused` |
| `unknownJob` | `❓ Unknown job` |
## Reference [#reference]
* [Replies](../reference/interfaces/Replies)
# Overriding texts (/docs/client/replies/overriding-texts)
Every text the library puts on the air comes from `client.replies`, the merge of `englishReplies` with
the `replies` option given to the `Client`.
## French in one line [#french-in-one-line]
`frenchReplies` is a complete French set. Pass it as `replies` and every text is French, with the same
parameters.
```ts title="main.ts"
const client = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }),
replies: frenchReplies,
});
```
## A few texts [#a-few-texts]
`replies` takes a partial object. Only the keys given replace the default. Function entries keep their
parameters.
```ts title="main.ts"
const client2 = new Client({
transport: new SerialTransport({ path: '/dev/ttyACM0' }),
replies: {
unknownCommandDM: '❓ Commande introuvable, tape /help',
cooldown: (seconds) => `⏳ Patiente encore ${seconds}s`,
},
});
```
## What stays English [#what-stays-english]
Command names and actions are not translated. `help`, `plugins`, `jobs` and the actions `load`,
`unload`, `reload`, `run`, `pause`, `resume` are the same in every bot.
## Reference [#reference]
* [Replies](../reference/interfaces/Replies)
* [englishReplies](../reference/variables/englishReplies)
* [frenchReplies](../reference/variables/frenchReplies)
* [mergeReplies](../reference/functions/mergeReplies)
# @meshcorejs/protocol (/docs/protocol/reference)
## Classes [#classes]
* [ByteReader](./classes/ByteReader.md)
* [ByteWriter](./classes/ByteWriter.md)
* [FrameDecoder](./classes/FrameDecoder.md)
## Interfaces [#interfaces]
* [AdvertPush](./interfaces/AdvertPush.md)
* [BattAndStorageFrame](./interfaces/BattAndStorageFrame.md)
* [ChannelInfoFrame](./interfaces/ChannelInfoFrame.md)
* [ChannelMessageFrame](./interfaces/ChannelMessageFrame.md)
* [ChannelRecord](./interfaces/ChannelRecord.md)
* [ContactDeletedPush](./interfaces/ContactDeletedPush.md)
* [ContactFrame](./interfaces/ContactFrame.md)
* [ContactMessageFrame](./interfaces/ContactMessageFrame.md)
* [ContactRecord](./interfaces/ContactRecord.md)
* [ContactsFullPush](./interfaces/ContactsFullPush.md)
* [ContactsStartFrame](./interfaces/ContactsStartFrame.md)
* [CurrentTimeFrame](./interfaces/CurrentTimeFrame.md)
* [DeviceInfo](./interfaces/DeviceInfo.md)
* [DeviceInfoFrame](./interfaces/DeviceInfoFrame.md)
* [DisabledFrame](./interfaces/DisabledFrame.md)
* [EndOfContactsFrame](./interfaces/EndOfContactsFrame.md)
* [ErrFrame](./interfaces/ErrFrame.md)
* [ExportContactFrame](./interfaces/ExportContactFrame.md)
* [MalformedFrame](./interfaces/MalformedFrame.md)
* [MsgWaitingPush](./interfaces/MsgWaitingPush.md)
* [NewAdvertPush](./interfaces/NewAdvertPush.md)
* [NoMoreMessagesFrame](./interfaces/NoMoreMessagesFrame.md)
* [OkFrame](./interfaces/OkFrame.md)
* [Path](./interfaces/Path.md)
* [PathLength](./interfaces/PathLength.md)
* [PathUpdatedPush](./interfaces/PathUpdatedPush.md)
* [SelfInfo](./interfaces/SelfInfo.md)
* [SelfInfoFrame](./interfaces/SelfInfoFrame.md)
* [SendChannelTxtMsgParams](./interfaces/SendChannelTxtMsgParams.md)
* [SendConfirmedPush](./interfaces/SendConfirmedPush.md)
* [SendTxtMsgParams](./interfaces/SendTxtMsgParams.md)
* [SentFrame](./interfaces/SentFrame.md)
* [SetAdvertLatLonCommand](./interfaces/SetAdvertLatLonCommand.md)
* [SetChannelParams](./interfaces/SetChannelParams.md)
* [SetRadioParamsCommand](./interfaces/SetRadioParamsCommand.md)
* [UnknownFrame](./interfaces/UnknownFrame.md)
## Type Aliases [#type-aliases]
* [ChannelMessageParams](./type-aliases/ChannelMessageParams.md)
* [ContactMessageParams](./type-aliases/ContactMessageParams.md)
* [DecodedFrame](./type-aliases/DecodedFrame.md)
* [FrameDirection](./type-aliases/FrameDirection.md)
* [PushFrame](./type-aliases/PushFrame.md)
* [ResponseFrame](./type-aliases/ResponseFrame.md)
## Variables [#variables]
* [APP\_TARGET\_VERSION](./variables/APP_TARGET_VERSION.md)
* [CHANNEL\_SECRET\_SIZE](./variables/CHANNEL_SECRET_SIZE.md)
* [CommandCode](./variables/CommandCode.md)
* [CONTACT\_URI\_PREFIX](./variables/CONTACT_URI_PREFIX.md)
* [ContactType](./variables/ContactType.md)
* [FROM\_RADIO\_MARKER](./variables/FROM_RADIO_MARKER.md)
* [MAX\_FRAME\_SIZE](./variables/MAX_FRAME_SIZE.md)
* [MAX\_PATH\_SIZE](./variables/MAX_PATH_SIZE.md)
* [MAX\_TEXT\_LEN](./variables/MAX_TEXT_LEN.md)
* [MIN\_FIRMWARE\_VERSION](./variables/MIN_FIRMWARE_VERSION.md)
* [NAME\_FIELD\_SIZE](./variables/NAME_FIELD_SIZE.md)
* [OUT\_PATH\_UNKNOWN](./variables/OUT_PATH_UNKNOWN.md)
* [PUB\_KEY\_PREFIX\_SIZE](./variables/PUB_KEY_PREFIX_SIZE.md)
* [PUB\_KEY\_SIZE](./variables/PUB_KEY_SIZE.md)
* [PUBLIC\_CHANNEL\_SECRET](./variables/PUBLIC_CHANNEL_SECRET.md)
* [PushCode](./variables/PushCode.md)
* [RadioErrorCode](./variables/RadioErrorCode.md)
* [ResponseCode](./variables/ResponseCode.md)
* [TO\_RADIO\_MARKER](./variables/TO_RADIO_MARKER.md)
* [TxtType](./variables/TxtType.md)
## Functions [#functions]
* [contactUri](./functions/contactUri.md)
* [decodeFrame](./functions/decodeFrame.md)
* [decodePath](./functions/decodePath.md)
* [decodePathLength](./functions/decodePathLength.md)
* [encodeAddUpdateContact](./functions/encodeAddUpdateContact.md)
* [encodeAdvertPush](./functions/encodeAdvertPush.md)
* [encodeAppStart](./functions/encodeAppStart.md)
* [encodeBattAndStorageResponse](./functions/encodeBattAndStorageResponse.md)
* [encodeChannelInfoResponse](./functions/encodeChannelInfoResponse.md)
* [encodeChannelMessageResponse](./functions/encodeChannelMessageResponse.md)
* [encodeContactDeletedPush](./functions/encodeContactDeletedPush.md)
* [encodeContactMessageResponse](./functions/encodeContactMessageResponse.md)
* [encodeContactResponse](./functions/encodeContactResponse.md)
* [encodeContactsFullPush](./functions/encodeContactsFullPush.md)
* [encodeContactsStartResponse](./functions/encodeContactsStartResponse.md)
* [encodeCurrentTimeResponse](./functions/encodeCurrentTimeResponse.md)
* [encodeDeviceInfoResponse](./functions/encodeDeviceInfoResponse.md)
* [encodeDeviceQuery](./functions/encodeDeviceQuery.md)
* [encodeEndOfContactsResponse](./functions/encodeEndOfContactsResponse.md)
* [encodeErrResponse](./functions/encodeErrResponse.md)
* [encodeExportContact](./functions/encodeExportContact.md)
* [encodeExportContactResponse](./functions/encodeExportContactResponse.md)
* [encodeFrame](./functions/encodeFrame.md)
* [encodeGetBattAndStorage](./functions/encodeGetBattAndStorage.md)
* [encodeGetChannel](./functions/encodeGetChannel.md)
* [encodeGetContactByKey](./functions/encodeGetContactByKey.md)
* [encodeGetContacts](./functions/encodeGetContacts.md)
* [encodeGetDeviceTime](./functions/encodeGetDeviceTime.md)
* [encodeMsgWaitingPush](./functions/encodeMsgWaitingPush.md)
* [encodeNewAdvertPush](./functions/encodeNewAdvertPush.md)
* [encodeNoMoreMessagesResponse](./functions/encodeNoMoreMessagesResponse.md)
* [encodeOkResponse](./functions/encodeOkResponse.md)
* [encodePath](./functions/encodePath.md)
* [encodePathUpdatedPush](./functions/encodePathUpdatedPush.md)
* [encodeRemoveContact](./functions/encodeRemoveContact.md)
* [encodeResetPath](./functions/encodeResetPath.md)
* [encodeSelfInfoResponse](./functions/encodeSelfInfoResponse.md)
* [encodeSendChannelTxtMsg](./functions/encodeSendChannelTxtMsg.md)
* [encodeSendConfirmedPush](./functions/encodeSendConfirmedPush.md)
* [encodeSendSelfAdvert](./functions/encodeSendSelfAdvert.md)
* [encodeSendTxtMsg](./functions/encodeSendTxtMsg.md)
* [encodeSentResponse](./functions/encodeSentResponse.md)
* [encodeSetAdvertLatLon](./functions/encodeSetAdvertLatLon.md)
* [encodeSetAdvertName](./functions/encodeSetAdvertName.md)
* [encodeSetChannel](./functions/encodeSetChannel.md)
* [encodeSetDeviceTime](./functions/encodeSetDeviceTime.md)
* [encodeSetRadioParams](./functions/encodeSetRadioParams.md)
* [encodeSetRadioTxPower](./functions/encodeSetRadioTxPower.md)
* [encodeSyncNextMessage](./functions/encodeSyncNextMessage.md)
* [fromHex](./functions/fromHex.md)
* [isPublicKeyHex](./functions/isPublicKeyHex.md)
* [parseContactUri](./functions/parseContactUri.md)
* [publicKeyPrefixToBytes](./functions/publicKeyPrefixToBytes.md)
* [publicKeyToBytes](./functions/publicKeyToBytes.md)
* [toHex](./functions/toHex.md)
* [utf8ByteLength](./functions/utf8ByteLength.md)
# @meshcorejs/testing (/docs/testing/reference)
## Classes [#classes]
* [FakeRadio](./classes/FakeRadio.md)
* [MockTransport](./classes/MockTransport.md)
## Interfaces [#interfaces]
* [FakeRadioOptions](./interfaces/FakeRadioOptions.md)
* [TestBot](./interfaces/TestBot.md)
* [TestClientOptions](./interfaces/TestClientOptions.md)
## Type Aliases [#type-aliases]
* [AckMode](./type-aliases/AckMode.md)
* [FakeSentMessage](./type-aliases/FakeSentMessage.md)
## Functions [#functions]
* [createTestClient](./functions/createTestClient.md)
* [fakeContactKey](./functions/fakeContactKey.md)
* [fakeContactRecord](./functions/fakeContactRecord.md)
* [parseDuration](./functions/parseDuration.md)
# @meshcorejs/transports (/docs/transports/reference)
## Modules [#modules]
* [@meshcorejs/transports](./main/index.md)
* [@meshcorejs/transports/mock](./mock/index.md)
# ArgBuilder<T, N, R, C> (/docs/client/reference/classes/ArgBuilder)
Defined in: [packages/client/src/commands/args.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L45)
Declares one command argument: chain `setName`, `setDescription`, type-specific setters, then `build()`.
## Type Parameters [#type-parameters]
### T [#t]
`T` *extends* [`ArgType`](../type-aliases/ArgType.md)
### N [#n]
`N` *extends* `string` = `string`
### R [#r]
`R` *extends* `boolean` = `false`
### C [#c]
`C` *extends* `string` = `string`
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ArgBuilder(type): ArgBuilder;
```
Defined in: [packages/client/src/commands/args.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L54)
#### Parameters [#parameters]
##### type [#type]
`T`
Argument type
#### Returns [#returns]
`ArgBuilder`\<`T`, `N`, `R`, `C`>
## Methods [#methods]
### build() [#build]
```ts
build(): object;
```
Defined in: [packages/client/src/commands/args.ts:142](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L142)
#### Returns [#returns-1]
`object`
##### definition [#definition]
```ts
definition: ArgDefinition;
```
##### problems [#problems]
```ts
problems: string[];
```
***
### setChoices() [#setchoices]
```ts
setChoices(this, ...choices): ArgBuilder<"choice", N, R, C2>;
```
Defined in: [packages/client/src/commands/args.ts:134](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L134)
#### Type Parameters [#type-parameters-1]
##### C2 [#c2]
`C2` *extends* `string`
#### Parameters [#parameters-1]
##### this [#this]
`ArgBuilder`\<`"choice"`, `N`, `R`, `C`>
##### choices [#choices]
...`C2`\[]
Accepted values
#### Returns [#returns-2]
`ArgBuilder`\<`"choice"`, `N`, `R`, `C2`>
***
### setDefault() [#setdefault]
```ts
setDefault(value): ArgBuilder;
```
Defined in: [packages/client/src/commands/args.ts:91](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L91)
#### Parameters [#parameters-2]
##### value [#value]
[`ArgValue`](../type-aliases/ArgValue.md)\<`T`, `C`>
Used when the argument is omitted, makes it optional
#### Returns [#returns-3]
`ArgBuilder`\<`T`, `N`, `true`, `C`>
***
### setDescription() [#setdescription]
```ts
setDescription(description): this;
```
Defined in: [packages/client/src/commands/args.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L79)
#### Parameters [#parameters-3]
##### description [#description]
`string`
Free text for the bot author
#### Returns [#returns-4]
`this`
***
### setMax() [#setmax]
```ts
setMax(this, max): ArgBuilder;
```
Defined in: [packages/client/src/commands/args.ts:128](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L128)
#### Parameters [#parameters-4]
##### this [#this-1]
`ArgBuilder`\<`"number"` | `"integer"`, `N`, `R`, `C`>
##### max [#max]
`number`
Maximum value
#### Returns [#returns-5]
`ArgBuilder`\<`T`, `N`, `R`, `C`>
***
### setMaxLength() [#setmaxlength]
```ts
setMaxLength(this, length): ArgBuilder<"string", N, R, C>;
```
Defined in: [packages/client/src/commands/args.ts:104](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L104)
#### Parameters [#parameters-5]
##### this [#this-2]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
##### length [#length]
`number`
Maximum length in characters
#### Returns [#returns-6]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
***
### setMin() [#setmin]
```ts
setMin(this, min): ArgBuilder;
```
Defined in: [packages/client/src/commands/args.ts:122](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L122)
#### Parameters [#parameters-6]
##### this [#this-3]
`ArgBuilder`\<`"number"` | `"integer"`, `N`, `R`, `C`>
##### min [#min]
`number`
Minimum value
#### Returns [#returns-7]
`ArgBuilder`\<`T`, `N`, `R`, `C`>
***
### setMinLength() [#setminlength]
```ts
setMinLength(this, length): ArgBuilder<"string", N, R, C>;
```
Defined in: [packages/client/src/commands/args.ts:98](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L98)
#### Parameters [#parameters-7]
##### this [#this-4]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
##### length [#length-1]
`number`
Minimum length in characters
#### Returns [#returns-8]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
***
### setName() [#setname]
```ts
setName(name): ArgBuilder;
```
Defined in: [packages/client/src/commands/args.ts:73](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L73)
#### Type Parameters [#type-parameters-2]
##### N2 [#n2]
`N2` *extends* `string`
#### Parameters [#parameters-8]
##### name [#name]
`N2`
Lowercase, letters digits and \_, 1 to 32 characters
#### Returns [#returns-9]
`ArgBuilder`\<`T`, `N2`, `R`, `C`>
***
### setPattern() [#setpattern]
```ts
setPattern(this, pattern): ArgBuilder<"string", N, R, C>;
```
Defined in: [packages/client/src/commands/args.ts:110](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L110)
#### Parameters [#parameters-9]
##### this [#this-5]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
##### pattern [#pattern]
`RegExp`
Regular expression the value must match
#### Returns [#returns-10]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
***
### setRequired() [#setrequired]
```ts
setRequired(required?): ArgBuilder;
```
Defined in: [packages/client/src/commands/args.ts:85](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L85)
#### Type Parameters [#type-parameters-3]
##### R2 [#r2]
`R2` *extends* `boolean` = `true`
#### Parameters [#parameters-10]
##### required? [#required]
`R2` = `...`
Default true
#### Returns [#returns-11]
`ArgBuilder`\<`T`, `N`, `R2`, `C`>
***
### setRest() [#setrest]
```ts
setRest(this, rest?): ArgBuilder<"string", N, R, C>;
```
Defined in: [packages/client/src/commands/args.ts:116](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L116)
#### Parameters [#parameters-11]
##### this [#this-6]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
##### rest? [#rest]
`boolean` = `true`
Take the rest of the line. Only for the last argument
#### Returns [#returns-12]
`ArgBuilder`\<`"string"`, `N`, `R`, `C`>
# ArgumentError (/docs/client/reference/classes/ArgumentError)
Defined in: [packages/client/src/commands/parse-args.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/parse-args.ts#L6)
Thrown while parsing a command's arguments; `reason` and `arg` say which one and why.
## Extends [#extends]
* `Error`
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ArgumentError(
reason,
arg,
detail
): ArgumentError;
```
Defined in: [packages/client/src/commands/parse-args.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/parse-args.ts#L15)
#### Parameters [#parameters]
##### reason [#reason]
`"invalid"` | `"missing"` | `"ambiguous"` | `"tooMany"`
missing, invalid or tooMany
##### arg [#arg]
[`ArgDefinition`](../interfaces/ArgDefinition.md) | `null`
Argument concerned, or null
##### detail [#detail]
`string`
Human readable detail
#### Returns [#returns]
`ArgumentError`
#### Overrides [#overrides]
```ts
Error.constructor
```
## Properties [#properties]
### arg [#arg-1]
```ts
readonly arg: ArgDefinition | null;
```
Defined in: [packages/client/src/commands/parse-args.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/parse-args.ts#L7)
***
### reason [#reason-1]
```ts
readonly reason: "invalid" | "missing" | "ambiguous" | "tooMany";
```
Defined in: [packages/client/src/commands/parse-args.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/parse-args.ts#L8)
# BleTransport (/docs/client/reference/classes/BleTransport)
Defined in: [packages/transports/src/ble.ts:66](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L66)
Transport over Bluetooth Low Energy (Nordic UART): scans for the radio, connects, one notification or write per frame. Needs `@abandonware/noble` installed.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<`TransportEvents`>
## Implements [#implements]
* [`Transport`](../interfaces/Transport.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new BleTransport(options?, deps?): BleTransport;
```
Defined in: [packages/transports/src/ble.ts:76](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L76)
#### Parameters [#parameters]
##### options? [#options]
[`BleTransportOptions`](../interfaces/BleTransportOptions.md) = `{}`
address or name of the radio, scanTimeoutMs. Default 15000
##### deps? [#deps]
`BleTransportDeps` = `{}`
Test seam replacing the noble import
#### Returns [#returns]
`BleTransport`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Properties [#properties]
### kind [#kind]
```ts
readonly kind: "ble" = 'ble';
```
Defined in: [packages/transports/src/ble.ts:67](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L67)
#### Implementation of [#implementation-of]
[`Transport`](../interfaces/Transport.md).[`kind`](../interfaces/Transport.md#kind)
## Accessors [#accessors]
### connected [#connected]
#### Get Signature [#get-signature]
```ts
get connected(): boolean;
```
Defined in: [packages/transports/src/ble.ts:83](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L83)
##### Returns [#returns-1]
`boolean`
#### Implementation of [#implementation-of-1]
[`Transport`](../interfaces/Transport.md).[`connected`](../interfaces/Transport.md#connected)
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/ble.ts:204](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L204)
#### Returns [#returns-2]
`Promise`\<`void`>
#### Implementation of [#implementation-of-2]
[`Transport`](../interfaces/Transport.md).[`close`](../interfaces/Transport.md#close)
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/ble.ts:88](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L88)
#### Parameters [#parameters-1]
##### signal? [#signal]
`AbortSignal`
Aborts the connection attempt
#### Returns [#returns-3]
`Promise`\<`void`>
#### Implementation of [#implementation-of-3]
[`Transport`](../interfaces/Transport.md).[`connect`](../interfaces/Transport.md#connect)
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...`TransportEvents`\[`K`]
Event arguments
#### Returns [#returns-4]
`boolean`
#### Implementation of [#implementation-of-4]
[`Transport`](../interfaces/Transport.md).[`emit`](../interfaces/Transport.md#emit)
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-5]
`number`
#### Implementation of [#implementation-of-5]
[`Transport`](../interfaces/Transport.md).[`listenerCount`](../interfaces/Transport.md#listenercount)
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<`TransportEvents`\[`K`]>
Listener to remove
#### Returns [#returns-6]
`this`
#### Implementation of [#implementation-of-6]
[`Transport`](../interfaces/Transport.md).[`off`](../interfaces/Transport.md#off)
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<`TransportEvents`\[`K`]>
Called with the event arguments
#### Returns [#returns-7]
`this`
#### Implementation of [#implementation-of-7]
[`Transport`](../interfaces/Transport.md).[`on`](../interfaces/Transport.md#on)
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<`TransportEvents`\[`K`]>
Called once with the event arguments
#### Returns [#returns-8]
`this`
#### Implementation of [#implementation-of-8]
[`Transport`](../interfaces/Transport.md).[`once`](../interfaces/Transport.md#once)
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-9]
`this`
#### Implementation of [#implementation-of-9]
[`Transport`](../interfaces/Transport.md).[`removeAllListeners`](../interfaces/Transport.md#removealllisteners)
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/ble.ts:194](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L194)
#### Parameters [#parameters-8]
##### payload [#payload]
`Uint8Array`
Frame payload without framing
#### Returns [#returns-10]
`Promise`\<`void`>
#### Implementation of [#implementation-of-10]
[`Transport`](../interfaces/Transport.md).[`write`](../interfaces/Transport.md#write)
# Channel (/docs/client/reference/classes/Channel)
Defined in: [packages/client/src/structures/channel.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L7)
A cached channel slot: name, secret, and `send()` to broadcast on it.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Channel(client, record): Channel;
```
Defined in: [packages/client/src/structures/channel.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L15)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
##### record [#record]
[`ChannelRecord`](../interfaces/ChannelRecord.md)
Channel as decoded from the radio
#### Returns [#returns]
`Channel`
## Properties [#properties]
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/structures/channel.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L8)
## Accessors [#accessors]
### index [#index]
#### Get Signature [#get-signature]
```ts
get index(): number;
```
Defined in: [packages/client/src/structures/channel.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L20)
##### Returns [#returns-1]
`number`
***
### isHashtag [#ishashtag]
#### Get Signature [#get-signature-1]
```ts
get isHashtag(): boolean;
```
Defined in: [packages/client/src/structures/channel.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L32)
##### Returns [#returns-2]
`boolean`
***
### isPublic [#ispublic]
#### Get Signature [#get-signature-2]
```ts
get isPublic(): boolean;
```
Defined in: [packages/client/src/structures/channel.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L37)
True for the firmware's built-in Public channel, identified by its secret (a renamed Public is still Public).
##### Returns [#returns-3]
`boolean`
***
### name [#name]
#### Get Signature [#get-signature-3]
```ts
get name(): string;
```
Defined in: [packages/client/src/structures/channel.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L24)
##### Returns [#returns-4]
`string`
***
### secret [#secret]
#### Get Signature [#get-signature-4]
```ts
get secret(): Uint8Array;
```
Defined in: [packages/client/src/structures/channel.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L28)
##### Returns [#returns-5]
`Uint8Array`
## Methods [#methods]
### send() [#send]
```ts
send(content): Promise;
```
Defined in: [packages/client/src/structures/channel.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L45)
#### Parameters [#parameters-1]
##### content [#content]
[`MessageContent`](../type-aliases/MessageContent.md)
Text or MessageBuilder
#### Returns [#returns-6]
`Promise`\<[`SentMessage`](./SentMessage.md)>
***
### toString() [#tostring]
```ts
toString(): string;
```
Defined in: [packages/client/src/structures/channel.ts:59](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/channel.ts#L59)
#### Returns [#returns-7]
`string`
# ChannelManager (/docs/client/reference/classes/ChannelManager)
Defined in: [packages/client/src/managers/channel-manager.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L20)
`client.channels`: caches the radio's channel slots and creates or deletes channels.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ChannelManager(client): ChannelManager;
```
Defined in: [packages/client/src/managers/channel-manager.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L25)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`ChannelManager`
## Properties [#properties]
### cache [#cache]
```ts
readonly cache: Collection;
```
Defined in: [packages/client/src/managers/channel-manager.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L22)
***
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/managers/channel-manager.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L21)
## Methods [#methods]
### create() [#create]
```ts
create(options): Promise;
```
Defined in: [packages/client/src/managers/channel-manager.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L49)
#### Parameters [#parameters-1]
##### options [#options]
[`CreateChannelOptions`](../interfaces/CreateChannelOptions.md)
name and optional secret, hashtag channels derive it
#### Returns [#returns-1]
`Promise`\<[`Channel`](./Channel.md)>
***
### delete() [#delete]
```ts
delete(channel): Promise;
```
Defined in: [packages/client/src/managers/channel-manager.ts:71](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L71)
#### Parameters [#parameters-2]
##### channel [#channel]
`string` | `number` | [`Channel`](./Channel.md)
Channel, name or slot
#### Returns [#returns-2]
`Promise`\<`void`>
***
### fetch() [#fetch]
```ts
fetch(options?): Promise>;
```
Defined in: [packages/client/src/managers/channel-manager.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L37)
#### Parameters [#parameters-3]
##### options? [#options-1]
emitEvents emits channelUpdate for the differences
###### emitEvents? [#emitevents]
`boolean`
#### Returns [#returns-3]
`Promise`\<[`Collection`](./Collection.md)\<`number`, [`Channel`](./Channel.md)>>
***
### get() [#get]
```ts
get(nameOrIndex): Channel | undefined;
```
Defined in: [packages/client/src/managers/channel-manager.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L30)
#### Parameters [#parameters-4]
##### nameOrIndex [#nameorindex]
`string` | `number`
Channel name or slot
#### Returns [#returns-4]
[`Channel`](./Channel.md) | `undefined`
# Client (/docs/client/reference/classes/Client)
Defined in: [packages/client/src/client/client.ts:72](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L72)
A bot: logs into a Companion radio over a Transport, keeps contact and channel caches, turns radio messages
into `Message` objects and runs the registered bricks. Takes infrastructure only (transport, radio config,
replies, logger); bot content comes from builders through `register()` / `load()`.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<[`ClientEvents`](../interfaces/ClientEvents.md)>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Client(options): Client;
```
Defined in: [packages/client/src/client/client.ts:104](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L104)
#### Parameters [#parameters]
##### options [#options]
[`ClientOptions`](../interfaces/ClientOptions.md)
Transport and optional radio config, replies, logger, app name and load directory
#### Returns [#returns]
`Client`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Properties [#properties]
### channels [#channels]
```ts
readonly channels: ChannelManager;
```
Defined in: [packages/client/src/client/client.ts:77](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L77)
***
### commands [#commands]
```ts
readonly commands: CommandManager;
```
Defined in: [packages/client/src/client/client.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L79)
***
### contacts [#contacts]
```ts
readonly contacts: ContactManager;
```
Defined in: [packages/client/src/client/client.ts:76](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L76)
***
### events [#events]
```ts
readonly events: EventManager;
```
Defined in: [packages/client/src/client/client.ts:80](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L80)
***
### jobs [#jobs]
```ts
readonly jobs: JobManager;
```
Defined in: [packages/client/src/client/client.ts:81](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L81)
***
### logger [#logger]
```ts
readonly logger: Logger;
```
Defined in: [packages/client/src/client/client.ts:74](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L74)
***
### maxHops [#maxhops]
```ts
readonly maxHops: number | null;
```
Defined in: [packages/client/src/client/client.ts:87](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L87)
***
### permissions [#permissions]
```ts
readonly permissions: PermissionManager;
```
Defined in: [packages/client/src/client/client.ts:82](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L82)
***
### plugins [#plugins]
```ts
readonly plugins: PluginManager;
```
Defined in: [packages/client/src/client/client.ts:84](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L84)
***
### radio [#radio]
```ts
readonly radio: Radio;
```
Defined in: [packages/client/src/client/client.ts:75](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L75)
***
### radioConfig [#radioconfig]
```ts
readonly radioConfig: RadioConfig | null;
```
Defined in: [packages/client/src/client/client.ts:86](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L86)
***
### replies [#replies]
```ts
readonly replies: Replies;
```
Defined in: [packages/client/src/client/client.ts:85](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L85)
***
### roles [#roles]
```ts
readonly roles: RoleManager;
```
Defined in: [packages/client/src/client/client.ts:83](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L83)
***
### sendQueue [#sendqueue]
```ts
readonly sendQueue: SendQueue;
```
Defined in: [packages/client/src/client/client.ts:78](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L78)
***
### transport [#transport]
```ts
readonly transport: Transport;
```
Defined in: [packages/client/src/client/client.ts:73](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L73)
## Accessors [#accessors]
### device [#device]
#### Get Signature [#get-signature]
```ts
get device(): DeviceInfo;
```
Defined in: [packages/client/src/client/client.ts:147](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L147)
##### Returns [#returns-1]
[`DeviceInfo`](../interfaces/DeviceInfo.md)
***
### isReady [#isready]
#### Get Signature [#get-signature-1]
```ts
get isReady(): boolean;
```
Defined in: [packages/client/src/client/client.ts:138](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L138)
##### Returns [#returns-2]
`boolean`
***
### self [#self]
#### Get Signature [#get-signature-2]
```ts
get self(): SelfInfo;
```
Defined in: [packages/client/src/client/client.ts:142](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L142)
##### Returns [#returns-3]
[`SelfInfo`](../interfaces/SelfInfo.md)
***
### status [#status]
#### Get Signature [#get-signature-3]
```ts
get status(): ClientStatus;
```
Defined in: [packages/client/src/client/client.ts:134](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L134)
##### Returns [#returns-4]
[`ClientStatus`](../type-aliases/ClientStatus.md)
## Methods [#methods]
### \_reportError() [#_reporterror]
```ts
_reportError(error, source): void;
```
Defined in: [packages/client/src/client/client.ts:219](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L219)
#### Parameters [#parameters-1]
##### error [#error]
`unknown`
##### source [#source]
[`ErrorSource`](../interfaces/ErrorSource.md)
#### Returns [#returns-5]
`void`
***
### destroy() [#destroy]
```ts
destroy(): Promise;
```
Defined in: [packages/client/src/client/client.ts:207](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L207)
#### Returns [#returns-6]
`Promise`\<`void`>
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...[`ClientEvents`](../interfaces/ClientEvents.md)\[`K`]
Event arguments
#### Returns [#returns-7]
`boolean`
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-8]
`number`
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### load() [#load]
```ts
load(directory, options?): Promise;
```
Defined in: [packages/client/src/client/client.ts:163](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L163)
#### Parameters [#parameters-4]
##### directory [#directory]
`string` | `URL`
Folder to scan, or a module path standing for its folder
##### options? [#options-1]
[`LoadOptions`](../interfaces/LoadOptions.md) = `{}`
watch enables hot reload
#### Returns [#returns-9]
`Promise`\<`void`>
***
### login() [#login]
```ts
login(): Promise;
```
Defined in: [packages/client/src/client/client.ts:171](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L171)
#### Returns [#returns-10]
`Promise`\<`void`>
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<[`ClientEvents`](../interfaces/ClientEvents.md)\[`K`]>
Listener to remove
#### Returns [#returns-11]
`this`
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<[`ClientEvents`](../interfaces/ClientEvents.md)\[`K`]>
Called with the event arguments
#### Returns [#returns-12]
`this`
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<[`ClientEvents`](../interfaces/ClientEvents.md)\[`K`]>
Called once with the event arguments
#### Returns [#returns-13]
`this`
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### register() [#register]
```ts
register(bricks): this;
```
Defined in: [packages/client/src/client/client.ts:153](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L153)
#### Parameters [#parameters-8]
##### bricks [#bricks]
\| [`Brick`](../interfaces/Brick.md)\<`unknown`>
\| [`Brick`](../interfaces/Brick.md)\<`unknown`>\[]
One builder or a list
#### Returns [#returns-14]
`this`
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-9]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-15]
`this`
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
# ClientStateError (/docs/client/reference/classes/ClientStateError)
Defined in: [packages/client/src/errors.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L9)
Thrown when a `Client` method is called in a state that forbids it (e.g. before `login()` resolves).
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ClientStateError(message): ClientStateError;
```
Defined in: [packages/client/src/errors.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L11)
#### Parameters [#parameters]
##### message [#message]
`string`
What was called in the wrong state
#### Returns [#returns]
`ClientStateError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
# Collection<K, V> (/docs/client/reference/classes/Collection)
Defined in: [packages/client/src/collection.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L5)
A `Map` with array-like read helpers (`find`, `filter`, `map`, `some`, `every`, `first`, `toArray`, `sorted`);
every manager's cache (`client.contacts`, `client.channels`, …) is one of these.
## Extends [#extends]
* `Map`\<`K`, `V`>
## Type Parameters [#type-parameters]
### K [#k]
`K`
### V [#v]
`V`
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Collection(entries?): Collection;
```
Defined in: [node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2015.collection.d.ts:51](https://github.com/meshcorejs/meshcore.js/blob/main/node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts#L51)
#### Parameters [#parameters]
##### entries? [#entries]
readonly readonly \[`K`, `V`]\[] | `null`
#### Returns [#returns]
`Collection`\<`K`, `V`>
#### Inherited from [#inherited-from]
```ts
Map.constructor
```
### Constructor [#constructor-1]
```ts
new Collection(iterable?): Collection;
```
Defined in: [node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2015.collection.d.ts:50](https://github.com/meshcorejs/meshcore.js/blob/main/node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts#L50)
#### Parameters [#parameters-1]
##### iterable? [#iterable]
`Iterable`\ | `null`
#### Returns [#returns-1]
`Collection`\<`K`, `V`>
#### Inherited from [#inherited-from-1]
```ts
Map.constructor
```
## Methods [#methods]
### every() [#every]
```ts
every(predicate): boolean;
```
Defined in: [packages/client/src/collection.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L32)
True if `predicate(value, key)` holds for every entry (vacuously true when empty).
#### Parameters [#parameters-2]
##### predicate [#predicate]
(`value`, `key`) => `boolean`
#### Returns [#returns-2]
`boolean`
***
### filter() [#filter]
```ts
filter(predicate): Collection;
```
Defined in: [packages/client/src/collection.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L13)
Returns a new `Collection` with only the entries for which `predicate(value, key)` is true.
#### Parameters [#parameters-3]
##### predicate [#predicate-1]
(`value`, `key`) => `boolean`
#### Returns [#returns-3]
`Collection`\<`K`, `V`>
***
### find() [#find]
```ts
find(predicate): V | undefined;
```
Defined in: [packages/client/src/collection.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L7)
Returns the first value for which `predicate(value, key)` is true, or `undefined`.
#### Parameters [#parameters-4]
##### predicate [#predicate-2]
(`value`, `key`) => `boolean`
#### Returns [#returns-4]
`V` | `undefined`
***
### first() [#first]
```ts
first(): V | undefined;
```
Defined in: [packages/client/src/collection.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L38)
The first value in insertion order, or `undefined` if the collection is empty.
#### Returns [#returns-5]
`V` | `undefined`
***
### map() [#map]
```ts
map(mapper): T[];
```
Defined in: [packages/client/src/collection.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L20)
Applies `mapper(value, key)` to every entry and returns the results as an array.
#### Type Parameters [#type-parameters-1]
##### T [#t]
`T`
#### Parameters [#parameters-5]
##### mapper [#mapper]
(`value`, `key`) => `T`
#### Returns [#returns-6]
`T`\[]
***
### some() [#some]
```ts
some(predicate): boolean;
```
Defined in: [packages/client/src/collection.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L27)
True if `predicate(value, key)` holds for at least one entry.
#### Parameters [#parameters-6]
##### predicate [#predicate-3]
(`value`, `key`) => `boolean`
#### Returns [#returns-7]
`boolean`
***
### sorted() [#sorted]
```ts
sorted(compare): V[];
```
Defined in: [packages/client/src/collection.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L48)
All values as a plain array, sorted with `compare` (same contract as `Array.prototype.sort`).
#### Parameters [#parameters-7]
##### compare [#compare]
(`a`, `b`) => `number`
#### Returns [#returns-8]
`V`\[]
***
### toArray() [#toarray]
```ts
toArray(): V[];
```
Defined in: [packages/client/src/collection.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/collection.ts#L43)
All values as a plain array, in insertion order.
#### Returns [#returns-9]
`V`\[]
# Command (/docs/client/reference/classes/Command)
Defined in: [packages/client/src/commands/command.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L40)
A registered command's definition, exposed for the built-in helper and for introspection.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Command(definition): Command;
```
Defined in: [packages/client/src/commands/command.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L54)
#### Parameters [#parameters]
##### definition [#definition]
[`CommandDefinition`](../interfaces/CommandDefinition.md)
Built by CommandBuilder
#### Returns [#returns]
`Command`
## Properties [#properties]
### aliases [#aliases]
```ts
readonly aliases: readonly string[];
```
Defined in: [packages/client/src/commands/command.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L43)
***
### args [#args]
```ts
readonly args: readonly ArgDefinition[];
```
Defined in: [packages/client/src/commands/command.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L44)
***
### cooldownSeconds [#cooldownseconds]
```ts
readonly cooldownSeconds: number;
```
Defined in: [packages/client/src/commands/command.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L46)
***
### core [#core]
```ts
readonly core: boolean;
```
Defined in: [packages/client/src/commands/command.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L49)
***
### description [#description]
```ts
readonly description: string;
```
Defined in: [packages/client/src/commands/command.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L42)
***
### maxAgeSeconds [#maxageseconds]
```ts
readonly maxAgeSeconds: number;
```
Defined in: [packages/client/src/commands/command.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L47)
***
### name [#name]
```ts
readonly name: string;
```
Defined in: [packages/client/src/commands/command.ts:41](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L41)
***
### requiredPermissions [#requiredpermissions]
```ts
readonly requiredPermissions: readonly string[];
```
Defined in: [packages/client/src/commands/command.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L48)
***
### scopes [#scopes]
```ts
readonly scopes: readonly CommandScope[];
```
Defined in: [packages/client/src/commands/command.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L45)
## Methods [#methods]
### allows() [#allows]
```ts
allows(scope): boolean;
```
Defined in: [packages/client/src/commands/command.ts:68](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L68)
#### Parameters [#parameters-1]
##### scope [#scope]
[`CommandScope`](../type-aliases/CommandScope.md)
dm, channel or public
#### Returns [#returns-1]
`boolean`
# CommandBuilder<Args> (/docs/client/reference/classes/CommandBuilder)
Defined in: [packages/client/src/commands/command-builder.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L36)
Declares a command. Chain `setName`, `setDescription`, `addArg`…, `setHandler`, then `build()` — which throws
a `LoadError` listing every problem. Triggered by `/name` in DM and `@Bot name` on channels; this rule is
fixed.
## Type Parameters [#type-parameters]
### Args [#args]
`Args` *extends* `object` = \{
}
## Implements [#implements]
* [`Brick`](../interfaces/Brick.md)\<[`CommandDefinition`](../interfaces/CommandDefinition.md)>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new CommandBuilder(options?): CommandBuilder;
```
Defined in: [packages/client/src/commands/command-builder.ts:52](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L52)
#### Parameters [#parameters]
##### options? [#options]
core marks a built-in command that may use a reserved name
###### core? [#core]
`boolean`
#### Returns [#returns]
`CommandBuilder`\<`Args`>
## Properties [#properties]
### \[BRICK] [#brick]
```ts
readonly [BRICK]: "command";
```
Defined in: [packages/client/src/commands/command-builder.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L37)
#### Implementation of [#implementation-of]
[`Brick`](../interfaces/Brick.md).[`[BRICK]`](../interfaces/Brick.md#brick)
## Methods [#methods]
### addAliases() [#addaliases]
```ts
addAliases(...aliases): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:69](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L69)
#### Parameters [#parameters-1]
##### aliases [#aliases]
...`string`\[]
Alternative names, same rules as the name
#### Returns [#returns-1]
`this`
***
### addBooleanArg() [#addbooleanarg]
```ts
addBooleanArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? boolean : boolean | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:96](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L96)
#### Type Parameters [#type-parameters-1]
##### N [#n]
`N` *extends* `string`
##### R [#r]
`R` *extends* `boolean`
#### Parameters [#parameters-2]
##### configure [#configure]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"boolean"`, `N`, `R`>
Receives the boolean argument builder and returns it
#### Returns [#returns-2]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? boolean : boolean | undefined })\[K] }>
***
### addChannelArg() [#addchannelarg]
```ts
addChannelArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? Channel : Channel | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:124](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L124)
#### Type Parameters [#type-parameters-2]
##### N [#n-1]
`N` *extends* `string`
##### R [#r-1]
`R` *extends* `boolean`
#### Parameters [#parameters-3]
##### configure [#configure-1]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"channel"`, `N`, `R`>
Receives the channel argument builder and returns it
#### Returns [#returns-3]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? Channel : Channel | undefined })\[K] }>
***
### addChoiceArg() [#addchoicearg]
```ts
addChoiceArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? C : C | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:103](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L103)
#### Type Parameters [#type-parameters-3]
##### N [#n-2]
`N` *extends* `string`
##### R [#r-2]
`R` *extends* `boolean`
##### C [#c]
`C` *extends* `string`
#### Parameters [#parameters-4]
##### configure [#configure-2]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"choice"`, `N`, `R`, `C`>
Receives the choice argument builder and returns it
#### Returns [#returns-4]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? C : C | undefined })\[K] }>
***
### addContactArg() [#addcontactarg]
```ts
addContactArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? Contact : Contact | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:110](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L110)
#### Type Parameters [#type-parameters-4]
##### N [#n-3]
`N` *extends* `string`
##### R [#r-3]
`R` *extends* `boolean`
#### Parameters [#parameters-5]
##### configure [#configure-3]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"contact"`, `N`, `R`>
Receives the contact argument builder and returns it
#### Returns [#returns-5]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? Contact : Contact | undefined })\[K] }>
***
### addIntegerArg() [#addintegerarg]
```ts
addIntegerArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? number : number | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:82](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L82)
#### Type Parameters [#type-parameters-5]
##### N [#n-4]
`N` *extends* `string`
##### R [#r-4]
`R` *extends* `boolean`
#### Parameters [#parameters-6]
##### configure [#configure-4]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"integer"`, `N`, `R`>
Receives the integer argument builder and returns it
#### Returns [#returns-6]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? number : number | undefined })\[K] }>
***
### addNumberArg() [#addnumberarg]
```ts
addNumberArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? number : number | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:89](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L89)
#### Type Parameters [#type-parameters-6]
##### N [#n-5]
`N` *extends* `string`
##### R [#r-5]
`R` *extends* `boolean`
#### Parameters [#parameters-7]
##### configure [#configure-5]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"number"`, `N`, `R`>
Receives the number argument builder and returns it
#### Returns [#returns-7]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? number : number | undefined })\[K] }>
***
### addRoleArg() [#addrolearg]
```ts
addRoleArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? Role : Role | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:117](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L117)
#### Type Parameters [#type-parameters-7]
##### N [#n-6]
`N` *extends* `string`
##### R [#r-6]
`R` *extends* `boolean`
#### Parameters [#parameters-8]
##### configure [#configure-6]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"role"`, `N`, `R`>
Receives the role argument builder and returns it
#### Returns [#returns-8]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? Role : Role | undefined })\[K] }>
***
### addStringArg() [#addstringarg]
```ts
addStringArg(configure): CommandBuilder<{ [K in string | number | symbol]: (Args & { [K in string]: R extends true ? string : string | undefined })[K] }>;
```
Defined in: [packages/client/src/commands/command-builder.ts:75](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L75)
#### Type Parameters [#type-parameters-8]
##### N [#n-7]
`N` *extends* `string`
##### R [#r-7]
`R` *extends* `boolean`
#### Parameters [#parameters-9]
##### configure [#configure-7]
(`arg`) => [`ArgBuilder`](./ArgBuilder.md)\<`"string"`, `N`, `R`>
Receives the string argument builder and returns it
#### Returns [#returns-9]
`CommandBuilder`\<\{ \[K in string | number | symbol]: (Args & \{ \[K in string]: R extends true ? string : string | undefined })\[K] }>
***
### build() [#build]
```ts
build(): CommandDefinition;
```
Defined in: [packages/client/src/commands/command-builder.ts:172](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L172)
#### Returns [#returns-10]
[`CommandDefinition`](../interfaces/CommandDefinition.md)
#### Implementation of [#implementation-of-1]
[`Brick`](../interfaces/Brick.md).[`build`](../interfaces/Brick.md#build)
***
### setCooldown() [#setcooldown]
```ts
setCooldown(seconds): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:137](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L137)
#### Parameters [#parameters-10]
##### seconds [#seconds]
`number`
Delay between two runs by the same author. Default 0
#### Returns [#returns-11]
`this`
***
### setDescription() [#setdescription]
```ts
setDescription(description): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:63](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L63)
#### Parameters [#parameters-11]
##### description [#description]
`string`
Free text for the bot author
#### Returns [#returns-12]
`this`
***
### setErrorHandler() [#seterrorhandler]
```ts
setErrorHandler(handler): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:161](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L161)
#### Parameters [#parameters-12]
##### handler [#handler]
[`CommandErrorHandler`](../type-aliases/CommandErrorHandler.md)
Builds the reply when the handler throws
#### Returns [#returns-13]
`this`
***
### setHandler() [#sethandler]
```ts
setHandler(handler): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:167](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L167)
#### Parameters [#parameters-13]
##### handler [#handler-1]
(`ctx`) => `unknown`
Runs the command with its typed context
#### Returns [#returns-14]
`this`
***
### setMaxAge() [#setmaxage]
```ts
setMaxAge(seconds): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:143](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L143)
#### Parameters [#parameters-14]
##### seconds [#seconds-1]
`number`
Backlog messages older than this are ignored. Default 300
#### Returns [#returns-15]
`this`
***
### setName() [#setname]
```ts
setName(name): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L57)
#### Parameters [#parameters-15]
##### name [#name]
`string`
Lowercase, letters digits \_ and -, 1 to 32 characters
#### Returns [#returns-16]
`this`
***
### setRequiredPermissions() [#setrequiredpermissions]
```ts
setRequiredPermissions(...permissions): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:149](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L149)
#### Parameters [#parameters-16]
##### permissions [#permissions]
...[`PermissionLike`](../type-aliases/PermissionLike.md)\[]
Permissions the author needs, all of them
#### Returns [#returns-17]
`this`
***
### setScope() [#setscope]
```ts
setScope(...scopes): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:131](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L131)
#### Parameters [#parameters-17]
##### scopes [#scopes]
...[`CommandScope`](../type-aliases/CommandScope.md)\[]
dm, channel and/or public. Default dm and channel; public must be opted in explicitly
#### Returns [#returns-18]
`this`
***
### setUsageErrorHandler() [#setusageerrorhandler]
```ts
setUsageErrorHandler(handler): this;
```
Defined in: [packages/client/src/commands/command-builder.ts:155](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-builder.ts#L155)
#### Parameters [#parameters-18]
##### handler [#handler-2]
[`UsageErrorHandler`](../type-aliases/UsageErrorHandler.md)
Builds the reply to an invalid argument
#### Returns [#returns-19]
`this`
# CommandContext<Args> (/docs/client/reference/classes/CommandContext)
Defined in: [packages/client/src/commands/context.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L36)
Handed to a command's handler: the parsed `args`, the triggering `message`, `reply()`, and permission checks.
## Type Parameters [#type-parameters]
### Args [#args]
`Args` *extends* `object` = `Record`\<`string`, `unknown`>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new CommandContext(
client,
command,
message,
args
): CommandContext;
```
Defined in: [packages/client/src/commands/context.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L49)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
##### command [#command]
[`Command`](./Command.md)
Command being run
##### message [#message]
[`Message`](./Message.md)
Message that triggered it
##### args [#args-1]
`Args`
Parsed arguments
#### Returns [#returns]
`CommandContext`\<`Args`>
## Properties [#properties]
### args [#args-2]
```ts
readonly args: Args;
```
Defined in: [packages/client/src/commands/context.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L40)
***
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/commands/context.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L37)
***
### command [#command-1]
```ts
readonly command: Command;
```
Defined in: [packages/client/src/commands/context.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L38)
***
### logger [#logger]
```ts
readonly logger: Logger;
```
Defined in: [packages/client/src/commands/context.ts:41](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L41)
***
### message [#message-1]
```ts
readonly message: Message;
```
Defined in: [packages/client/src/commands/context.ts:39](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L39)
## Accessors [#accessors]
### author [#author]
#### Get Signature [#get-signature]
```ts
get author(): Author;
```
Defined in: [packages/client/src/commands/context.ts:63](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L63)
##### Returns [#returns-1]
[`Author`](../type-aliases/Author.md)
***
### channel [#channel]
#### Get Signature [#get-signature-1]
```ts
get channel(): Channel | null;
```
Defined in: [packages/client/src/commands/context.ts:67](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L67)
##### Returns [#returns-2]
[`Channel`](./Channel.md) | `null`
***
### isDM [#isdm]
#### Get Signature [#get-signature-2]
```ts
get isDM(): boolean;
```
Defined in: [packages/client/src/commands/context.ts:71](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L71)
##### Returns [#returns-3]
`boolean`
## Methods [#methods]
### can() [#can]
```ts
can(permission): Promise;
```
Defined in: [packages/client/src/commands/context.ts:84](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L84)
#### Parameters [#parameters-1]
##### permission [#permission]
[`PermissionLike`](../type-aliases/PermissionLike.md)
Permission to check for the author
#### Returns [#returns-4]
`Promise`\<`boolean`>
***
### canManageContact() [#canmanagecontact]
```ts
canManageContact(contact): Promise;
```
Defined in: [packages/client/src/commands/context.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L94)
#### Parameters [#parameters-2]
##### contact [#contact]
[`Contact`](./Contact.md)
Contact the author wants to act on
#### Returns [#returns-5]
`Promise`\<`boolean`>
***
### canManageRole() [#canmanagerole]
```ts
canManageRole(role): Promise;
```
Defined in: [packages/client/src/commands/context.ts:89](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L89)
#### Parameters [#parameters-3]
##### role [#role]
[`Role`](./Role.md)
Role the author wants to give or take
#### Returns [#returns-6]
`Promise`\<`boolean`>
***
### reply() [#reply]
```ts
reply(content, options?): Promise;
```
Defined in: [packages/client/src/commands/context.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L79)
#### Parameters [#parameters-4]
##### content [#content]
[`MessageContent`](../type-aliases/MessageContent.md)
Text or MessageBuilder
##### options? [#options]
mention prefixes the author on a channel. Default true
###### mention? [#mention]
`boolean`
#### Returns [#returns-7]
`Promise`\<[`SentMessage`](./SentMessage.md)>
***
### replyDM() [#replydm]
```ts
replyDM(content): Promise;
```
Defined in: [packages/client/src/commands/context.ts:99](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L99)
#### Parameters [#parameters-5]
##### content [#content-1]
[`MessageContent`](../type-aliases/MessageContent.md)
Text or MessageBuilder, sent to the author as a DM
#### Returns [#returns-8]
`Promise`\<[`SentMessage`](./SentMessage.md)>
# CommandManager (/docs/client/reference/classes/CommandManager)
Defined in: [packages/client/src/commands/command-manager.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-manager.ts#L22)
`client.commands`: matches incoming messages against registered commands, runs the pipeline (trigger, scope,
backlog, permissions, cooldown, argument parsing, handler), and answers the built-in helper.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new CommandManager(client): CommandManager;
```
Defined in: [packages/client/src/commands/command-manager.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-manager.ts#L30)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`CommandManager`
## Properties [#properties]
### cache [#cache]
```ts
readonly cache: Collection;
```
Defined in: [packages/client/src/commands/command-manager.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-manager.ts#L24)
***
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/commands/command-manager.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-manager.ts#L23)
## Accessors [#accessors]
### inFlight [#inflight]
#### Get Signature [#get-signature]
```ts
get inFlight(): number;
```
Defined in: [packages/client/src/commands/command-manager.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-manager.ts#L46)
##### Returns [#returns-1]
`number`
***
### size [#size]
#### Get Signature [#get-signature-1]
```ts
get size(): number;
```
Defined in: [packages/client/src/commands/command-manager.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-manager.ts#L42)
##### Returns [#returns-2]
`number`
## Methods [#methods]
### get() [#get]
```ts
get(nameOrAlias): Command | undefined;
```
Defined in: [packages/client/src/commands/command-manager.ts:51](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command-manager.ts#L51)
#### Parameters [#parameters-1]
##### nameOrAlias [#nameoralias]
`string`
Command name or alias
#### Returns [#returns-3]
[`Command`](./Command.md) | `undefined`
# CommandTimeoutError (/docs/client/reference/classes/CommandTimeoutError)
Defined in: [packages/client/src/errors.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L36)
Thrown when the radio does not answer a Companion command within its timeout.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new CommandTimeoutError(command, timeoutMs): CommandTimeoutError;
```
Defined in: [packages/client/src/errors.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L44)
#### Parameters [#parameters]
##### command [#command]
`string`
Companion command name
##### timeoutMs [#timeoutms]
`number`
Delay waited
#### Returns [#returns]
`CommandTimeoutError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### command [#command-1]
```ts
readonly command: string;
```
Defined in: [packages/client/src/errors.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L37)
***
### timeoutMs [#timeoutms-1]
```ts
readonly timeoutMs: number;
```
Defined in: [packages/client/src/errors.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L38)
# ConnectionError (/docs/client/reference/classes/ConnectionError)
Defined in: [packages/transports/src/errors.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L13)
The transport could not connect, or the connection was lost (`code: 'CONNECTION_FAILED'`).
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ConnectionError(message, options?): ConnectionError;
```
Defined in: [packages/transports/src/errors.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L14)
#### Parameters [#parameters]
##### message [#message]
`string`
##### options? [#options]
`ErrorOptions`
#### Returns [#returns]
`ConnectionError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
# Contact (/docs/client/reference/classes/Contact)
Defined in: [packages/client/src/structures/contact.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L18)
A cached entry from the radio's contact table: identity, path, location, and `send()` for direct messages.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Contact(client, record): Contact;
```
Defined in: [packages/client/src/structures/contact.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L27)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
##### record [#record]
[`ContactRecord`](../interfaces/ContactRecord.md)
Contact as decoded from the radio
#### Returns [#returns]
`Contact`
## Properties [#properties]
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/structures/contact.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L19)
***
### verified [#verified]
```ts
readonly verified: true;
```
Defined in: [packages/client/src/structures/contact.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L20)
## Accessors [#accessors]
### lastAdvert [#lastadvert]
#### Get Signature [#get-signature]
```ts
get lastAdvert(): Date;
```
Defined in: [packages/client/src/structures/contact.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L56)
##### Returns [#returns-1]
`Date`
***
### lastSeen [#lastseen]
#### Get Signature [#get-signature-1]
```ts
get lastSeen(): Date;
```
Defined in: [packages/client/src/structures/contact.ts:60](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L60)
##### Returns [#returns-2]
`Date`
***
### location [#location]
#### Get Signature [#get-signature-2]
```ts
get location():
| {
latitude: number;
longitude: number;
}
| null;
```
Defined in: [packages/client/src/structures/contact.ts:64](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L64)
##### Returns [#returns-3]
\| \{
`latitude`: `number`;
`longitude`: `number`;
}
\| `null`
***
### name [#name]
#### Get Signature [#get-signature-3]
```ts
get name(): string;
```
Defined in: [packages/client/src/structures/contact.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L44)
##### Returns [#returns-4]
`string`
***
### path [#path]
#### Get Signature [#get-signature-4]
```ts
get path(): Path | null;
```
Defined in: [packages/client/src/structures/contact.ts:52](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L52)
##### Returns [#returns-5]
[`Path`](../interfaces/Path.md) | `null`
***
### publicKey [#publickey]
#### Get Signature [#get-signature-5]
```ts
get publicKey(): string;
```
Defined in: [packages/client/src/structures/contact.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L36)
##### Returns [#returns-6]
`string`
***
### record [#record-1]
#### Get Signature [#get-signature-6]
```ts
get record(): Readonly;
```
Defined in: [packages/client/src/structures/contact.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L32)
##### Returns [#returns-7]
`Readonly`\<[`ContactRecord`](../interfaces/ContactRecord.md)>
***
### shortKey [#shortkey]
#### Get Signature [#get-signature-7]
```ts
get shortKey(): string;
```
Defined in: [packages/client/src/structures/contact.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L40)
##### Returns [#returns-8]
`string`
***
### type [#type]
#### Get Signature [#get-signature-8]
```ts
get type(): ContactKind;
```
Defined in: [packages/client/src/structures/contact.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L48)
##### Returns [#returns-9]
[`ContactKind`](../type-aliases/ContactKind.md)
## Methods [#methods]
### send() [#send]
```ts
send(content): Promise;
```
Defined in: [packages/client/src/structures/contact.ts:70](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L70)
#### Parameters [#parameters-1]
##### content [#content]
[`MessageContent`](../type-aliases/MessageContent.md)
Text or MessageBuilder
#### Returns [#returns-10]
`Promise`\<[`SentMessage`](./SentMessage.md)>
***
### toString() [#tostring]
```ts
toString(): string;
```
Defined in: [packages/client/src/structures/contact.ts:96](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L96)
#### Returns [#returns-11]
`string`
# ContactManager (/docs/client/reference/classes/ContactManager)
Defined in: [packages/client/src/managers/contact-manager.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L17)
`client.contacts`: caches the radio's contact table, looks contacts up by key or prefix, removes them.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ContactManager(client): ContactManager;
```
Defined in: [packages/client/src/managers/contact-manager.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L22)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`ContactManager`
## Properties [#properties]
### cache [#cache]
```ts
readonly cache: Collection;
```
Defined in: [packages/client/src/managers/contact-manager.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L19)
***
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/managers/contact-manager.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L18)
## Methods [#methods]
### fetch() [#fetch]
```ts
fetch(options?): Promise>;
```
Defined in: [packages/client/src/managers/contact-manager.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L36)
#### Parameters [#parameters-1]
##### options? [#options]
emitEvents emits contact events for the differences
###### emitEvents? [#emitevents]
`boolean`
#### Returns [#returns-1]
`Promise`\<[`Collection`](./Collection.md)\<`string`, [`Contact`](./Contact.md)>>
***
### get() [#get]
```ts
get(keyOrPrefix): Contact | undefined;
```
Defined in: [packages/client/src/managers/contact-manager.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L27)
#### Parameters [#parameters-2]
##### keyOrPrefix [#keyorprefix]
`string`
Full key or a prefix of 12 hex characters or more
#### Returns [#returns-2]
[`Contact`](./Contact.md) | `undefined`
***
### remove() [#remove]
```ts
remove(contact): Promise;
```
Defined in: [packages/client/src/managers/contact-manager.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L53)
#### Parameters [#parameters-3]
##### contact [#contact]
`string` | [`Contact`](./Contact.md)
Contact or public key
#### Returns [#returns-3]
`Promise`\<`void`>
***
### resetPath() [#resetpath]
```ts
resetPath(contact): Promise;
```
Defined in: [packages/client/src/managers/contact-manager.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L61)
#### Parameters [#parameters-4]
##### contact [#contact-1]
[`Contact`](./Contact.md)
Contact to flood again
#### Returns [#returns-4]
`Promise`\<`void`>
# DeliveryFailedError (/docs/client/reference/classes/DeliveryFailedError)
Defined in: [packages/client/src/errors.ts:211](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L211)
Rejection reason of the promise returned by `contact.send()` / `SentMessage` when a DM was not delivered.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new DeliveryFailedError(
reason,
message,
options?
): DeliveryFailedError;
```
Defined in: [packages/client/src/errors.ts:219](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L219)
#### Parameters [#parameters]
##### reason [#reason]
[`DeliveryFailureReason`](../type-aliases/DeliveryFailureReason.md)
noAck, expired, radio or destroyed
##### message [#message]
`string`
Human readable detail
##### options? [#options]
`ErrorOptions`
cause
#### Returns [#returns]
`DeliveryFailedError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### reason [#reason-1]
```ts
readonly reason: DeliveryFailureReason;
```
Defined in: [packages/client/src/errors.ts:212](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L212)
# EventBuilder<E> (/docs/client/reference/classes/EventBuilder)
Defined in: [packages/client/src/events/event-builder.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L16)
What every builder (`CommandBuilder`, `EventBuilder`, …) produces: a `build()` method tagged with its kind.
## Type Parameters [#type-parameters]
### E [#e]
`E` *extends* [`EventName`](../type-aliases/EventName.md) = [`EventName`](../type-aliases/EventName.md)
## Implements [#implements]
* [`Brick`](../interfaces/Brick.md)\<[`EventDefinition`](../interfaces/EventDefinition.md)>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new EventBuilder(): EventBuilder;
```
#### Returns [#returns]
`EventBuilder`\<`E`>
## Properties [#properties]
### \[BRICK] [#brick]
```ts
readonly [BRICK]: "event";
```
Defined in: [packages/client/src/events/event-builder.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L17)
#### Implementation of [#implementation-of]
[`Brick`](../interfaces/Brick.md).[`[BRICK]`](../interfaces/Brick.md#brick)
## Methods [#methods]
### build() [#build]
```ts
build(): EventDefinition;
```
Defined in: [packages/client/src/events/event-builder.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L40)
#### Returns [#returns-1]
[`EventDefinition`](../interfaces/EventDefinition.md)
#### Implementation of [#implementation-of-1]
[`Brick`](../interfaces/Brick.md).[`build`](../interfaces/Brick.md#build)
***
### setEvent() [#setevent]
```ts
setEvent(event): EventBuilder;
```
Defined in: [packages/client/src/events/event-builder.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L23)
#### Type Parameters [#type-parameters-1]
##### E2 [#e2]
`E2` *extends* `string`
#### Parameters [#parameters]
##### event [#event]
`E2`
A Client event name
#### Returns [#returns-2]
`EventBuilder`\<`E2`>
***
### setHandler() [#sethandler]
```ts
setHandler(handler): this;
```
Defined in: [packages/client/src/events/event-builder.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L35)
#### Parameters [#parameters-1]
##### handler [#handler]
(`client`, ...`args`) => `unknown`
Receives the client and the event arguments
#### Returns [#returns-3]
`this`
***
### setOnce() [#setonce]
```ts
setOnce(once?): this;
```
Defined in: [packages/client/src/events/event-builder.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L29)
#### Parameters [#parameters-2]
##### once? [#once]
`boolean` = `true`
Run the handler only once. Default true
#### Returns [#returns-4]
`this`
# EventManager (/docs/client/reference/classes/EventManager)
Defined in: [packages/client/src/events/event-manager.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-manager.ts#L11)
`client.events`: the event bricks currently registered, with the listeners attached to the client.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new EventManager(client): EventManager;
```
Defined in: [packages/client/src/events/event-manager.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-manager.ts#L16)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`EventManager`
## Properties [#properties]
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/events/event-manager.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-manager.ts#L12)
## Accessors [#accessors]
### size [#size]
#### Get Signature [#get-signature]
```ts
get size(): number;
```
Defined in: [packages/client/src/events/event-manager.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-manager.ts#L20)
##### Returns [#returns-1]
`number`
# GuardedCommandError (/docs/client/reference/classes/GuardedCommandError)
Defined in: [packages/client/src/errors.ts:134](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L134)
Thrown by `client.radio.request()` for the three Companion commands that transmit on the mesh
(`SendTxtMsg`, `SendChannelTxtMsg`, `SendSelfAdvert`): they only go through `SendQueue` and `sendSelfAdvert()`,
which carry the anti-spam limits.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new GuardedCommandError(commandCode): GuardedCommandError;
```
Defined in: [packages/client/src/errors.ts:138](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L138)
#### Parameters [#parameters]
##### commandCode [#commandcode]
`number`
The refused Companion command code
#### Returns [#returns]
`GuardedCommandError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### commandCode [#commandcode-1]
```ts
readonly commandCode: number;
```
Defined in: [packages/client/src/errors.ts:135](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L135)
# Job (/docs/client/reference/classes/Job)
Defined in: [packages/client/src/jobs/job.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L7)
A registered job: run it now, pause and resume it, read its last and next run. Built from a `JobBuilder` by the client.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Job(client, definition): Job;
```
Defined in: [packages/client/src/jobs/job.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L26)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
##### definition [#definition]
[`JobDefinition`](../interfaces/JobDefinition.md)
Built by JobBuilder
#### Returns [#returns]
`Job`
## Properties [#properties]
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/jobs/job.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L8)
***
### name [#name]
```ts
readonly name: string;
```
Defined in: [packages/client/src/jobs/job.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L9)
## Accessors [#accessors]
### lastRun [#lastrun]
#### Get Signature [#get-signature]
```ts
get lastRun(): Date | null;
```
Defined in: [packages/client/src/jobs/job.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L40)
##### Returns [#returns-1]
`Date` | `null`
***
### nextRun [#nextrun]
#### Get Signature [#get-signature-1]
```ts
get nextRun(): Date | null;
```
Defined in: [packages/client/src/jobs/job.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L44)
##### Returns [#returns-2]
`Date` | `null`
***
### paused [#paused]
#### Get Signature [#get-signature-2]
```ts
get paused(): boolean;
```
Defined in: [packages/client/src/jobs/job.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L36)
##### Returns [#returns-3]
`boolean`
***
### running [#running]
#### Get Signature [#get-signature-3]
```ts
get running(): boolean;
```
Defined in: [packages/client/src/jobs/job.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L32)
##### Returns [#returns-4]
`boolean`
## Methods [#methods]
### pause() [#pause]
```ts
pause(): void;
```
Defined in: [packages/client/src/jobs/job.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L53)
#### Returns [#returns-5]
`void`
***
### resume() [#resume]
```ts
resume(): void;
```
Defined in: [packages/client/src/jobs/job.ts:58](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L58)
#### Returns [#returns-6]
`void`
***
### run() [#run]
```ts
run(): Promise;
```
Defined in: [packages/client/src/jobs/job.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job.ts#L49)
#### Returns [#returns-7]
`Promise`\<`void`>
# JobBuilder (/docs/client/reference/classes/JobBuilder)
Defined in: [packages/client/src/jobs/job-builder.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L35)
What every builder (`CommandBuilder`, `EventBuilder`, …) produces: a `build()` method tagged with its kind.
## Implements [#implements]
* [`Brick`](../interfaces/Brick.md)\<[`JobDefinition`](../interfaces/JobDefinition.md)>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new JobBuilder(): JobBuilder;
```
#### Returns [#returns]
`JobBuilder`
## Properties [#properties]
### \[BRICK] [#brick]
```ts
readonly [BRICK]: "job";
```
Defined in: [packages/client/src/jobs/job-builder.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L36)
#### Implementation of [#implementation-of]
[`Brick`](../interfaces/Brick.md).[`[BRICK]`](../interfaces/Brick.md#brick)
## Methods [#methods]
### build() [#build]
```ts
build(): JobDefinition;
```
Defined in: [packages/client/src/jobs/job-builder.ts:97](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L97)
#### Returns [#returns-1]
[`JobDefinition`](../interfaces/JobDefinition.md)
#### Implementation of [#implementation-of-1]
[`Brick`](../interfaces/Brick.md).[`build`](../interfaces/Brick.md#build)
***
### setCron() [#setcron]
```ts
setCron(expression, options?): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L56)
#### Parameters [#parameters]
##### expression [#expression]
`string`
Cron expression
##### options? [#options]
timezone is an IANA name
###### timezone? [#timezone]
`string`
#### Returns [#returns-2]
`this`
***
### setHandler() [#sethandler]
```ts
setHandler(handler): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:92](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L92)
#### Parameters [#parameters-1]
##### handler [#handler]
(`client`, `job`) => `unknown`
Receives the client and the run info
#### Returns [#returns-3]
`this`
***
### setInterval() [#setinterval]
```ts
setInterval(seconds): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:62](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L62)
#### Parameters [#parameters-2]
##### seconds [#seconds]
`number`
Delay between two runs
#### Returns [#returns-4]
`this`
***
### setName() [#setname]
```ts
setName(name): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L47)
#### Parameters [#parameters-3]
##### name [#name]
`string`
Lowercase, letters digits \_ and -, 1 to 32 characters
#### Returns [#returns-5]
`this`
***
### setOverlap() [#setoverlap]
```ts
setOverlap(policy): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:74](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L74)
#### Parameters [#parameters-4]
##### policy [#policy]
[`OverlapPolicy`](../type-aliases/OverlapPolicy.md)
skip or queue a run while the previous one is still going
#### Returns [#returns-6]
`this`
***
### setRequiresConnection() [#setrequiresconnection]
```ts
setRequiresConnection(requiresConnection): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:86](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L86)
#### Parameters [#parameters-5]
##### requiresConnection [#requiresconnection]
`boolean`
Skip scheduled runs while the radio is disconnected
#### Returns [#returns-7]
`this`
***
### setRunOnStart() [#setrunonstart]
```ts
setRunOnStart(runOnStart?): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:68](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L68)
#### Parameters [#parameters-6]
##### runOnStart? [#runonstart]
`boolean` = `true`
Run once when the client is ready. Default true
#### Returns [#returns-8]
`this`
***
### setTimeout() [#settimeout]
```ts
setTimeout(seconds): this;
```
Defined in: [packages/client/src/jobs/job-builder.ts:80](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L80)
#### Parameters [#parameters-7]
##### seconds [#seconds-1]
`number`
Abort the run after this delay. 0 disables
#### Returns [#returns-9]
`this`
# JobManager (/docs/client/reference/classes/JobManager)
Defined in: [packages/client/src/jobs/job-manager.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-manager.ts#L8)
`client.jobs`: the registered jobs by name, started after `ready` and stopped on `destroy()`.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new JobManager(client): JobManager;
```
Defined in: [packages/client/src/jobs/job-manager.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-manager.ts#L15)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`JobManager`
## Properties [#properties]
### cache [#cache]
```ts
readonly cache: Collection;
```
Defined in: [packages/client/src/jobs/job-manager.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-manager.ts#L10)
***
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/jobs/job-manager.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-manager.ts#L9)
## Accessors [#accessors]
### size [#size]
#### Get Signature [#get-signature]
```ts
get size(): number;
```
Defined in: [packages/client/src/jobs/job-manager.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-manager.ts#L19)
##### Returns [#returns-1]
`number`
## Methods [#methods]
### get() [#get]
```ts
get(name): Job | undefined;
```
Defined in: [packages/client/src/jobs/job-manager.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-manager.ts#L24)
#### Parameters [#parameters-1]
##### name [#name]
`string`
Job name
#### Returns [#returns-2]
[`Job`](./Job.md) | `undefined`
# JobTimeoutError (/docs/client/reference/classes/JobTimeoutError)
Defined in: [packages/client/src/errors.ts:245](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L245)
Thrown internally when a job's handler does not finish within its configured timeout; reported via `error`.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new JobTimeoutError(job, timeoutSeconds): JobTimeoutError;
```
Defined in: [packages/client/src/errors.ts:253](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L253)
#### Parameters [#parameters]
##### job [#job]
`string`
Job name
##### timeoutSeconds [#timeoutseconds]
`number`
Delay waited
#### Returns [#returns]
`JobTimeoutError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### job [#job-1]
```ts
readonly job: string;
```
Defined in: [packages/client/src/errors.ts:246](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L246)
***
### timeoutSeconds [#timeoutseconds-1]
```ts
readonly timeoutSeconds: number;
```
Defined in: [packages/client/src/errors.ts:247](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L247)
# LimitReachedError (/docs/client/reference/classes/LimitReachedError)
Defined in: [packages/client/src/errors.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L79)
Thrown when the radio has no free channel or contact slot left for the requested operation.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new LimitReachedError(resource, limit): LimitReachedError;
```
Defined in: [packages/client/src/errors.ts:87](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L87)
#### Parameters [#parameters]
##### resource [#resource]
`"channels"` | `"contacts"`
channels or contacts
##### limit [#limit]
`number`
Slots on the radio
#### Returns [#returns]
`LimitReachedError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### limit [#limit-1]
```ts
readonly limit: number;
```
Defined in: [packages/client/src/errors.ts:81](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L81)
***
### resource [#resource-1]
```ts
readonly resource: "channels" | "contacts";
```
Defined in: [packages/client/src/errors.ts:80](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L80)
# LoadError (/docs/client/reference/classes/LoadError)
Defined in: [packages/client/src/errors.ts:233](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L233)
Thrown by `load()`, `login()` and `plugin.load()/unload()/reload()` when one or more bricks fail validation.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new LoadError(issues): LoadError;
```
Defined in: [packages/client/src/errors.ts:237](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L237)
#### Parameters [#parameters]
##### issues [#issues]
[`LoadIssue`](../interfaces/LoadIssue.md)\[]
Every problem found, with file and brick
#### Returns [#returns]
`LoadError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### issues [#issues-1]
```ts
readonly issues: readonly LoadIssue[];
```
Defined in: [packages/client/src/errors.ts:234](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L234)
# MeshcoreError (/docs/client/reference/classes/MeshcoreError)
Defined in: [packages/transports/src/errors.ts:2](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L2)
Base class of the library's errors: `code` identifies the kind without parsing the message.
## Extends [#extends]
* `Error`
## Extended by [#extended-by]
* [`ClientStateError`](./ClientStateError.md)
* [`CommandTimeoutError`](./CommandTimeoutError.md)
* [`ConnectionError`](./ConnectionError.md)
* [`DeliveryFailedError`](./DeliveryFailedError.md)
* [`GuardedCommandError`](./GuardedCommandError.md)
* [`JobTimeoutError`](./JobTimeoutError.md)
* [`LimitReachedError`](./LimitReachedError.md)
* [`LoadError`](./LoadError.md)
* [`MessageTooLongError`](./MessageTooLongError.md)
* [`MissingDependencyError`](./MissingDependencyError.md)
* [`PublicChannelError`](./PublicChannelError.md)
* [`RadioConfigError`](./RadioConfigError.md)
* [`RadioError`](./RadioError.md)
* [`RateLimitError`](./RateLimitError.md)
* [`TooFarError`](./TooFarError.md)
* [`UnsupportedFirmwareError`](./UnsupportedFirmwareError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new MeshcoreError(
code,
message,
options?
): MeshcoreError;
```
Defined in: [packages/transports/src/errors.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L5)
#### Parameters [#parameters]
##### code [#code]
`string`
##### message [#message]
`string`
##### options? [#options]
`ErrorOptions`
#### Returns [#returns]
`MeshcoreError`
#### Overrides [#overrides]
```ts
Error.constructor
```
## Properties [#properties]
### code [#code-1]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
# Message (/docs/client/reference/classes/Message)
Defined in: [packages/client/src/structures/message.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L30)
A direct or channel message received from the radio, with `reply()` to answer it.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Message(client, data): Message;
```
Defined in: [packages/client/src/structures/message.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L44)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
##### data [#data]
[`MessageData`](../interfaces/MessageData.md)
Decoded message fields
#### Returns [#returns]
`Message`
## Properties [#properties]
### author [#author]
```ts
readonly author: Author;
```
Defined in: [packages/client/src/structures/message.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L37)
***
### backlog [#backlog]
```ts
readonly backlog: boolean;
```
Defined in: [packages/client/src/structures/message.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L36)
***
### channel [#channel]
```ts
readonly channel: Channel | null;
```
Defined in: [packages/client/src/structures/message.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L38)
***
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/structures/message.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L31)
***
### content [#content]
```ts
readonly content: string;
```
Defined in: [packages/client/src/structures/message.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L32)
***
### createdAt [#createdat]
```ts
readonly createdAt: Date;
```
Defined in: [packages/client/src/structures/message.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L33)
***
### hopCount [#hopcount]
```ts
readonly hopCount: number | null;
```
Defined in: [packages/client/src/structures/message.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L35)
***
### snr [#snr]
```ts
readonly snr: number | null;
```
Defined in: [packages/client/src/structures/message.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L34)
## Accessors [#accessors]
### isDM [#isdm]
#### Get Signature [#get-signature]
```ts
get isDM(): boolean;
```
Defined in: [packages/client/src/structures/message.ts:55](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L55)
##### Returns [#returns-1]
`boolean`
***
### tooFar [#toofar]
#### Get Signature [#get-signature-1]
```ts
get tooFar(): boolean;
```
Defined in: [packages/client/src/structures/message.ts:60](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L60)
True when the message travelled more hops than the client's `maxHops`; false without a limit or an unknown route.
##### Returns [#returns-2]
`boolean`
## Methods [#methods]
### reply() [#reply]
```ts
reply(content, options?): Promise;
```
Defined in: [packages/client/src/structures/message.ts:69](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L69)
#### Parameters [#parameters-1]
##### content [#content-1]
[`MessageContent`](../type-aliases/MessageContent.md)
Text or MessageBuilder
##### options? [#options]
mention prefixes the author on a channel. Default true
###### mention? [#mention]
`boolean`
#### Returns [#returns-3]
`Promise`\<[`SentMessage`](./SentMessage.md)>
# MessageBuilder (/docs/client/reference/classes/MessageBuilder)
Defined in: [packages/client/src/builders/message-builder.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L17)
Builds a byte-budgeted text: title, lines, fields, footer; `build(budget)` errors, truncates or splits per
`setOverflow`.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new MessageBuilder(): MessageBuilder;
```
#### Returns [#returns]
`MessageBuilder`
## Accessors [#accessors]
### overflow [#overflow]
#### Get Signature [#get-signature]
```ts
get overflow(): OverflowMode;
```
Defined in: [packages/client/src/builders/message-builder.ts:69](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L69)
##### Returns [#returns-1]
[`OverflowMode`](../type-aliases/OverflowMode.md)
## Methods [#methods]
### addField() [#addfield]
```ts
addField(name, value): this;
```
Defined in: [packages/client/src/builders/message-builder.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L46)
#### Parameters [#parameters]
##### name [#name]
`string`
Field label
##### value [#value]
`string`
Field value
#### Returns [#returns-2]
`this`
***
### addLine() [#addline]
```ts
addLine(text): this;
```
Defined in: [packages/client/src/builders/message-builder.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L31)
#### Parameters [#parameters-1]
##### text [#text]
`string`
One line
#### Returns [#returns-3]
`this`
***
### addLines() [#addlines]
```ts
addLines(texts): this;
```
Defined in: [packages/client/src/builders/message-builder.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L37)
#### Parameters [#parameters-2]
##### texts [#texts]
`Iterable`\<`string`>
One line each
#### Returns [#returns-4]
`this`
***
### build() [#build]
```ts
build(budget): string[];
```
Defined in: [packages/client/src/builders/message-builder.ts:82](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L82)
#### Parameters [#parameters-3]
##### budget [#budget]
`number`
Budget in UTF-8 bytes
#### Returns [#returns-5]
`string`\[]
***
### measure() [#measure]
```ts
measure(budget?): object;
```
Defined in: [packages/client/src/builders/message-builder.ts:74](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L74)
#### Parameters [#parameters-4]
##### budget? [#budget-1]
`number` = `DM_TEXT_BUDGET`
Budget in UTF-8 bytes. Default the DM budget
#### Returns [#returns-6]
`object`
##### bytes [#bytes]
```ts
bytes: number;
```
##### limit [#limit]
```ts
limit: number;
```
##### parts [#parts]
```ts
parts: number;
```
***
### setFooter() [#setfooter]
```ts
setFooter(text): this;
```
Defined in: [packages/client/src/builders/message-builder.ts:52](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L52)
#### Parameters [#parameters-5]
##### text [#text-1]
`string`
Last line
#### Returns [#returns-7]
`this`
***
### setOverflow() [#setoverflow]
```ts
setOverflow(mode, options?): this;
```
Defined in: [packages/client/src/builders/message-builder.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L61)
#### Parameters [#parameters-6]
##### mode [#mode]
[`OverflowMode`](../type-aliases/OverflowMode.md)
error, truncate or split when the text exceeds the budget
##### options? [#options]
maxParts for split. Default 3
###### maxParts? [#maxparts]
`number`
#### Returns [#returns-8]
`this`
***
### setTitle() [#settitle]
```ts
setTitle(text): this;
```
Defined in: [packages/client/src/builders/message-builder.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L25)
#### Parameters [#parameters-7]
##### text [#text-2]
`string`
First line
#### Returns [#returns-9]
`this`
***
### toString() [#tostring]
```ts
toString(): string;
```
Defined in: [packages/client/src/builders/message-builder.ts:100](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L100)
#### Returns [#returns-10]
`string`
# MessageTooLongError (/docs/client/reference/classes/MessageTooLongError)
Defined in: [packages/client/src/errors.ts:98](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L98)
Thrown when a plain string does not fit its text budget; `MessageBuilder` with `setOverflow('truncate' |
'split')` avoids it instead of throwing.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new MessageTooLongError(bytes, limit): MessageTooLongError;
```
Defined in: [packages/client/src/errors.ts:106](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L106)
#### Parameters [#parameters]
##### bytes [#bytes]
`number`
Size of the message
##### limit [#limit]
`number`
Budget it had to fit in
#### Returns [#returns]
`MessageTooLongError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### bytes [#bytes-1]
```ts
readonly bytes: number;
```
Defined in: [packages/client/src/errors.ts:99](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L99)
***
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### limit [#limit-1]
```ts
readonly limit: number;
```
Defined in: [packages/client/src/errors.ts:100](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L100)
# MissingDependencyError (/docs/client/reference/classes/MissingDependencyError)
Defined in: [packages/transports/src/errors.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L20)
An optional dependency (`serialport`, `@abandonware/noble`) is not installed; the message says what to run.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new MissingDependencyError(moduleName, options?): MissingDependencyError;
```
Defined in: [packages/transports/src/errors.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L23)
#### Parameters [#parameters]
##### moduleName [#modulename]
`string`
##### options? [#options]
`ErrorOptions`
#### Returns [#returns]
`MissingDependencyError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### moduleName [#modulename-1]
```ts
readonly moduleName: string;
```
Defined in: [packages/transports/src/errors.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L21)
# PermissionBuilder (/docs/client/reference/classes/PermissionBuilder)
Defined in: [packages/client/src/permissions/permission-builder.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L14)
What every builder (`CommandBuilder`, `EventBuilder`, …) produces: a `build()` method tagged with its kind.
## Implements [#implements]
* [`Brick`](../interfaces/Brick.md)\<[`PermissionDefinition`](../interfaces/PermissionDefinition.md)>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new PermissionBuilder(options?): PermissionBuilder;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L21)
#### Parameters [#parameters]
##### options? [#options]
core allows the reserved core. prefix
###### core? [#core]
`boolean`
#### Returns [#returns]
`PermissionBuilder`
## Properties [#properties]
### \[BRICK] [#brick]
```ts
readonly [BRICK]: "permission";
```
Defined in: [packages/client/src/permissions/permission-builder.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L15)
#### Implementation of [#implementation-of]
[`Brick`](../interfaces/Brick.md).[`[BRICK]`](../interfaces/Brick.md#brick)
## Accessors [#accessors]
### name [#name]
#### Get Signature [#get-signature]
```ts
get name(): string;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L25)
##### Returns [#returns-1]
`string`
## Methods [#methods]
### build() [#build]
```ts
build(): PermissionDefinition;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:41](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L41)
#### Returns [#returns-2]
[`PermissionDefinition`](../interfaces/PermissionDefinition.md)
#### Implementation of [#implementation-of-1]
[`Brick`](../interfaces/Brick.md).[`build`](../interfaces/Brick.md#build)
***
### setDescription() [#setdescription]
```ts
setDescription(description): this;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L36)
#### Parameters [#parameters-1]
##### description [#description]
`string`
Free text for the bot author
#### Returns [#returns-3]
`this`
***
### setName() [#setname]
```ts
setName(name): this;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L30)
#### Parameters [#parameters-2]
##### name [#name-1]
`string`
Lowercase, letters digits \_ . and -, 1 to 64 characters
#### Returns [#returns-4]
`this`
# PermissionManager (/docs/client/reference/classes/PermissionManager)
Defined in: [packages/client/src/permissions/permission-manager.ts:83](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L83)
`client.permissions`: the registered permissions and the checks the command dispatcher runs before a handler: `has()`, `missing()`, `holders()`.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new PermissionManager(client): PermissionManager;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:88](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L88)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`PermissionManager`
## Properties [#properties]
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:84](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L84)
## Methods [#methods]
### canManageContact() [#canmanagecontact]
```ts
canManageContact(author, target): Promise;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:194](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L194)
#### Parameters [#parameters-1]
##### author [#author]
[`Author`](../type-aliases/Author.md)
Message author
##### target [#target]
[`Contact`](./Contact.md)
Contact to act on
#### Returns [#returns-1]
`Promise`\<`boolean`>
***
### canManageRole() [#canmanagerole]
```ts
canManageRole(author, role): Promise;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:186](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L186)
#### Parameters [#parameters-2]
##### author [#author-1]
[`Author`](../type-aliases/Author.md)
Message author
##### role [#role]
[`Role`](./Role.md)
Role to give or take
#### Returns [#returns-2]
`Promise`\<`boolean`>
***
### get() [#get]
```ts
get(permission): Permission | undefined;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L94)
#### Parameters [#parameters-3]
##### permission [#permission]
[`PermissionLike`](../type-aliases/PermissionLike.md)
Permission builder or name
#### Returns [#returns-3]
[`Permission`](../interfaces/Permission.md) | `undefined`
***
### has() [#has]
```ts
has(author, permission): Promise;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:161](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L161)
#### Parameters [#parameters-4]
##### author [#author-2]
[`Author`](../type-aliases/Author.md)
Message author
##### permission [#permission-1]
[`PermissionLike`](../type-aliases/PermissionLike.md)
Permission builder or name
#### Returns [#returns-4]
`Promise`\<`boolean`>
***
### hasRole() [#hasrole]
```ts
hasRole(author, role): Promise;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:140](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L140)
#### Parameters [#parameters-5]
##### author [#author-3]
[`Author`](../type-aliases/Author.md)
Message author
##### role [#role-1]
`string` | [`Role`](./Role.md)
Role or role name
#### Returns [#returns-5]
`Promise`\<`boolean`>
***
### list() [#list]
```ts
list(): Permission[];
```
Defined in: [packages/client/src/permissions/permission-manager.ts:99](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L99)
#### Returns [#returns-6]
[`Permission`](../interfaces/Permission.md)\[]
***
### rank() [#rank]
```ts
rank(author): Promise;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:177](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L177)
#### Parameters [#parameters-6]
##### author [#author-4]
[`Author`](../type-aliases/Author.md)
Message author
#### Returns [#returns-7]
`Promise`\<`number`>
***
### resolve() [#resolve]
```ts
resolve(author): Promise>;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:146](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L146)
#### Parameters [#parameters-7]
##### author [#author-5]
[`Author`](../type-aliases/Author.md)
Message author
#### Returns [#returns-8]
`Promise`\<`Set`\<[`Permission`](../interfaces/Permission.md)>>
***
### rolesOf() [#rolesof]
```ts
rolesOf(author): Promise;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:129](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L129)
#### Parameters [#parameters-8]
##### author [#author-6]
[`Author`](../type-aliases/Author.md)
Message author
#### Returns [#returns-9]
`Promise`\<[`Role`](./Role.md)\[]>
***
### whoHas() [#whohas]
```ts
whoHas(permission): Promise;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:200](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L200)
#### Parameters [#parameters-9]
##### permission [#permission-2]
[`PermissionLike`](../type-aliases/PermissionLike.md)
Permission builder or name
#### Returns [#returns-10]
`Promise`\<[`PermissionHolder`](../interfaces/PermissionHolder.md)\[]>
# Plugin (/docs/client/reference/classes/Plugin)
Defined in: [packages/client/src/plugins/plugin.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L11)
A registered plugin: its state, its current bricks, and `load()` / `unload()` / `reload()`. A failed reload keeps the previous bricks.
## Properties [#properties]
### description [#description]
```ts
readonly description: string | undefined;
```
Defined in: [packages/client/src/plugins/plugin.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L13)
***
### name [#name]
```ts
readonly name: string;
```
Defined in: [packages/client/src/plugins/plugin.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L12)
## Accessors [#accessors]
### bricks [#bricks]
#### Get Signature [#get-signature]
```ts
get bricks(): readonly Brick[];
```
Defined in: [packages/client/src/plugins/plugin.ts:39](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L39)
##### Returns [#returns]
readonly [`Brick`](../interfaces/Brick.md)\<`unknown`>\[]
***
### loaded [#loaded]
#### Get Signature [#get-signature-1]
```ts
get loaded(): boolean;
```
Defined in: [packages/client/src/plugins/plugin.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L35)
##### Returns [#returns-1]
`boolean`
***
### state [#state]
#### Get Signature [#get-signature-2]
```ts
get state(): PluginState;
```
Defined in: [packages/client/src/plugins/plugin.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L31)
##### Returns [#returns-2]
[`PluginState`](../type-aliases/PluginState.md)
## Methods [#methods]
### load() [#load]
```ts
load(): Promise;
```
Defined in: [packages/client/src/plugins/plugin.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L43)
#### Returns [#returns-3]
`Promise`\<`void`>
***
### reload() [#reload]
```ts
reload(): Promise;
```
Defined in: [packages/client/src/plugins/plugin.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L56)
#### Returns [#returns-4]
`Promise`\<`void`>
***
### unload() [#unload]
```ts
unload(): Promise;
```
Defined in: [packages/client/src/plugins/plugin.ts:50](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L50)
#### Returns [#returns-5]
`Promise`\<`void`>
# PluginBuilder<Options> (/docs/client/reference/classes/PluginBuilder)
Defined in: [packages/client/src/plugins/plugin-builder.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L22)
What every builder (`CommandBuilder`, `EventBuilder`, …) produces: a `build()` method tagged with its kind.
## Type Parameters [#type-parameters]
### Options [#options]
`Options` = `void`
## Implements [#implements]
* [`Brick`](../interfaces/Brick.md)\<[`PluginDefinition`](../interfaces/PluginDefinition.md)\<`Options`>>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new PluginBuilder(): PluginBuilder;
```
#### Returns [#returns]
`PluginBuilder`\<`Options`>
## Properties [#properties]
### \[BRICK] [#brick]
```ts
readonly [BRICK]: "plugin";
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L23)
#### Implementation of [#implementation-of]
[`Brick`](../interfaces/Brick.md).[`[BRICK]`](../interfaces/Brick.md#brick)
## Methods [#methods]
### addBricks() [#addbricks]
```ts
addBricks(...bricks): this;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:50](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L50)
#### Parameters [#parameters]
##### bricks [#bricks]
...[`Brick`](../interfaces/Brick.md)\<`unknown`>\[]
Static list of bricks
#### Returns [#returns-1]
`this`
***
### build() [#build]
```ts
build(): PluginDefinition;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:68](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L68)
#### Returns [#returns-2]
[`PluginDefinition`](../interfaces/PluginDefinition.md)\<`Options`>
#### Implementation of [#implementation-of-1]
[`Brick`](../interfaces/Brick.md).[`build`](../interfaces/Brick.md#build)
***
### configure() [#configure]
```ts
configure(this, options): PluginBuilder;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L56)
#### Parameters [#parameters-1]
##### this [#this]
`Options` *extends* `void` ? `never` : `PluginBuilder`\<`Options`>
##### options [#options-1]
`Options`
Options given to the factory
#### Returns [#returns-3]
`PluginBuilder`\<`Options`>
***
### setBricks() [#setbricks]
```ts
setBricks(factory): this;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L44)
#### Parameters [#parameters-2]
##### factory [#factory]
[`PluginBricksFactory`](../type-aliases/PluginBricksFactory.md)\<`Options`>
Receives the client and the options, returns the bricks
#### Returns [#returns-4]
`this`
***
### setDescription() [#setdescription]
```ts
setDescription(description): this;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L38)
#### Parameters [#parameters-3]
##### description [#description]
`string`
Free text for the bot author
#### Returns [#returns-5]
`this`
***
### setName() [#setname]
```ts
setName(name): this;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L32)
#### Parameters [#parameters-4]
##### name [#name]
`string`
Lowercase, letters digits \_ and -, 1 to 32 characters
#### Returns [#returns-6]
`this`
# PluginManager (/docs/client/reference/classes/PluginManager)
Defined in: [packages/client/src/plugins/plugin-manager.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-manager.ts#L9)
`client.plugins`: the registered plugins by name, loaded by `login()`; `load()`, `unload()` and `reload()` at runtime.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new PluginManager(client): PluginManager;
```
Defined in: [packages/client/src/plugins/plugin-manager.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-manager.ts#L16)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`PluginManager`
## Properties [#properties]
### cache [#cache]
```ts
readonly cache: Collection;
```
Defined in: [packages/client/src/plugins/plugin-manager.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-manager.ts#L11)
***
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/plugins/plugin-manager.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-manager.ts#L10)
## Accessors [#accessors]
### size [#size]
#### Get Signature [#get-signature]
```ts
get size(): number;
```
Defined in: [packages/client/src/plugins/plugin-manager.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-manager.ts#L20)
##### Returns [#returns-1]
`number`
## Methods [#methods]
### get() [#get]
#### Call Signature [#call-signature]
```ts
get(name): Plugin | undefined;
```
Defined in: [packages/client/src/plugins/plugin-manager.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-manager.ts#L25)
##### Parameters [#parameters-1]
###### name [#name]
`string`
Plugin name
##### Returns [#returns-2]
[`Plugin`](./Plugin.md) | `undefined`
#### Call Signature [#call-signature-1]
```ts
get(builder): Plugin;
```
Defined in: [packages/client/src/plugins/plugin-manager.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-manager.ts#L27)
##### Parameters [#parameters-2]
###### builder [#builder]
[`Brick`](../interfaces/Brick.md)
The registered PluginBuilder
##### Returns [#returns-3]
[`Plugin`](./Plugin.md)
# PublicChannelError (/docs/client/reference/classes/PublicChannelError)
Defined in: [packages/client/src/errors.ts:120](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L120)
Thrown by `channel.send()` and `message.reply()` on the Public channel: a bot never speaks first on Public.
Only `ctx.reply()` of a command that opted in with `setScope('public')` may answer there.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new PublicChannelError(): PublicChannelError;
```
Defined in: [packages/client/src/errors.ts:121](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L121)
#### Returns [#returns]
`PublicChannelError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
# Radio (/docs/client/reference/classes/Radio)
Defined in: [packages/client/src/radio/radio.ts:99](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L99)
`client.radio`: typed wrappers around the Companion commands (`appStart`, `deviceQuery`, `getContacts`,
`sendText`, …), one request in flight at a time.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<[`RadioEvents`](../interfaces/RadioEvents.md)>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Radio(transport, options?): Radio;
```
Defined in: [packages/client/src/radio/radio.ts:107](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L107)
#### Parameters [#parameters]
##### transport [#transport]
[`Transport`](../interfaces/Transport.md)
Connected or not, the radio only writes frames
##### options? [#options]
[`RadioOptions`](../interfaces/RadioOptions.md) = `{}`
timeoutMs per request. Default 5000
#### Returns [#returns]
`Radio`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Methods [#methods]
### appStart() [#appstart]
```ts
appStart(appName): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:151](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L151)
#### Parameters [#parameters-1]
##### appName [#appname]
`string`
Name announced to the radio
#### Returns [#returns-1]
`Promise`\<[`SelfInfo`](../interfaces/SelfInfo.md)>
***
### deviceQuery() [#devicequery]
```ts
deviceQuery(): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:159](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L159)
#### Returns [#returns-2]
`Promise`\<[`DeviceInfo`](../interfaces/DeviceInfo.md)>
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...[`RadioEvents`](../interfaces/RadioEvents.md)\[`K`]
Event arguments
#### Returns [#returns-3]
`boolean`
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### exportSelfContact() [#exportselfcontact]
```ts
exportSelfContact(): Promise<{
packet: Uint8Array;
uri: string;
}>;
```
Defined in: [packages/client/src/radio/radio.ts:254](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L254)
#### Returns [#returns-4]
`Promise`\<\{
`packet`: `Uint8Array`;
`uri`: `string`;
}>
***
### getBattAndStorage() [#getbattandstorage]
```ts
getBattAndStorage(): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:246](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L246)
#### Returns [#returns-5]
`Promise`\<`BattAndStorageFrame`>
***
### getChannel() [#getchannel]
```ts
getChannel(index): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:220](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L220)
#### Parameters [#parameters-3]
##### index [#index]
`number`
Channel slot
#### Returns [#returns-6]
`Promise`\<[`ChannelRecord`](../interfaces/ChannelRecord.md) | `null`>
***
### getContactByKey() [#getcontactbykey]
```ts
getContactByKey(publicKey): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:196](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L196)
#### Parameters [#parameters-4]
##### publicKey [#publickey]
`string`
Full public key in hex
#### Returns [#returns-7]
`Promise`\<[`ContactRecord`](../interfaces/ContactRecord.md) | `null`>
***
### getContacts() [#getcontacts]
```ts
getContacts(since?): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:178](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L178)
#### Parameters [#parameters-5]
##### since? [#since]
`number`
Only contacts modified after this epoch
#### Returns [#returns-8]
`Promise`\<[`ContactRecord`](../interfaces/ContactRecord.md)\[]>
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-9]
`number`
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<[`RadioEvents`](../interfaces/RadioEvents.md)\[`K`]>
Listener to remove
#### Returns [#returns-10]
`this`
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-8]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<[`RadioEvents`](../interfaces/RadioEvents.md)\[`K`]>
Called with the event arguments
#### Returns [#returns-11]
`this`
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-9]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<[`RadioEvents`](../interfaces/RadioEvents.md)\[`K`]>
Called once with the event arguments
#### Returns [#returns-12]
`this`
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-10]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-13]
`this`
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
***
### removeContact() [#removecontact]
```ts
removeContact(publicKey): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:210](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L210)
#### Parameters [#parameters-11]
##### publicKey [#publickey-1]
`string`
Full public key in hex
#### Returns [#returns-14]
`Promise`\<`void`>
***
### request() [#request]
```ts
request(
code,
payload?,
collect?
): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:126](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L126)
Send a Companion command that has no typed wrapper, through the same one-request-in-flight queue as the
wrappers. Never write raw frames to `client.transport`. The three commands that transmit on the mesh are
refused with `GuardedCommandError`.
#### Type Parameters [#type-parameters-6]
##### T [#t]
`T` = `void`
#### Parameters [#parameters-12]
##### code [#code]
`number`
Companion command code (`CommandCode.*`, or a byte the protocol does not know yet)
##### payload? [#payload]
`Uint8Array` = `...`
Command body without the code byte. Default empty
##### collect? [#collect]
[`Collector`](../type-aliases/Collector.md)\<`T`> = `...`
Turns response frames into the result. Default: expects `Ok`
#### Returns [#returns-15]
`Promise`\<`T`>
***
### reset() [#reset]
```ts
reset(error): void;
```
Defined in: [packages/client/src/radio/radio.ts:114](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L114)
#### Parameters [#parameters-13]
##### error [#error]
`Error`
Rejects every pending request with it
#### Returns [#returns-16]
`void`
***
### resetPath() [#resetpath]
```ts
resetPath(publicKey): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:215](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L215)
#### Parameters [#parameters-14]
##### publicKey [#publickey-2]
`string`
Full public key in hex
#### Returns [#returns-17]
`Promise`\<`void`>
***
### sendSelfAdvert() [#sendselfadvert]
```ts
sendSelfAdvert(flood): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:270](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L270)
#### Parameters [#parameters-15]
##### flood [#flood]
`boolean`
Flood the mesh instead of a zero-hop advert; at most one flood per `ADVERT_FLOOD_INTERVAL_MS`
(`RateLimitError` otherwise), the window is reserved before the request so two concurrent calls cannot both
pass, and released again only when the failure proves nothing was transmitted (a `RadioError`, i.e. the
firmware answered `Err`). Any other failure, notably a `CommandTimeoutError`, keeps the window consumed:
a lost reply does not mean the flood never went out, and the reconnect loop retries `login()` on its own.
#### Returns [#returns-18]
`Promise`\<`void`>
***
### setAdvertLatLon() [#setadvertlatlon]
```ts
setAdvertLatLon(location): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:320](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L320)
#### Parameters [#parameters-16]
##### location [#location]
[`Location`](../interfaces/Location.md)
lat and lon in decimal degrees
#### Returns [#returns-19]
`Promise`\<`void`>
***
### setAdvertName() [#setadvertname]
```ts
setAdvertName(name): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:314](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L314)
#### Parameters [#parameters-17]
##### name [#name]
`string`
1 to 31 UTF-8 bytes
#### Returns [#returns-20]
`Promise`\<`void`>
***
### setChannel() [#setchannel]
```ts
setChannel(params): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:234](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L234)
#### Parameters [#parameters-18]
##### params [#params]
`SetChannelParams`
Slot, name and secret
#### Returns [#returns-21]
`Promise`\<`void`>
***
### setDeviceTime() [#setdevicetime]
```ts
setDeviceTime(epochSeconds): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:168](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L168)
#### Parameters [#parameters-19]
##### epochSeconds [#epochseconds]
`number`
Current time in seconds
#### Returns [#returns-22]
`Promise`\<`void`>
***
### setRadioParams() [#setradioparams]
```ts
setRadioParams(params, options?): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:342](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L342)
#### Parameters [#parameters-20]
##### params [#params-1]
[`RadioParams`](../interfaces/RadioParams.md)
frequency in MHz, bandwidth in kHz, spreadingFactor and codingRate
##### options? [#options-1]
repeat writes the repeater byte, firmware 9 and later
###### repeat? [#repeat]
`boolean`
#### Returns [#returns-23]
`Promise`\<`void`>
***
### setTxPower() [#settxpower]
```ts
setTxPower(dbm): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:333](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L333)
#### Parameters [#parameters-21]
##### dbm [#dbm]
`number`
9 to the radio maximum
#### Returns [#returns-24]
`Promise`\<`void`>
***
### syncNextMessage() [#syncnextmessage]
```ts
syncNextMessage(): Promise;
```
Defined in: [packages/client/src/radio/radio.ts:238](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L238)
#### Returns [#returns-25]
`Promise`\<`ContactMessageFrame` | `ChannelMessageFrame` | `null`>
# RadioConfig (/docs/client/reference/classes/RadioConfig)
Defined in: [packages/client/src/radio/radio-config.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L28)
Desired radio settings applied at `login()`: only declared fields are touched, only when they differ from
`client.self`. Validated and frozen at construction.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new RadioConfig(options): RadioConfig;
```
Defined in: [packages/client/src/radio/radio-config.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L35)
#### Parameters [#parameters]
##### options [#options]
[`RadioConfigOptions`](../interfaces/RadioConfigOptions.md)
name, location, txPower and params. Absent fields are never touched
#### Returns [#returns]
`RadioConfig`
## Properties [#properties]
### location? [#location]
```ts
readonly optional location?: Readonly;
```
Defined in: [packages/client/src/radio/radio-config.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L30)
***
### name? [#name]
```ts
readonly optional name?: string;
```
Defined in: [packages/client/src/radio/radio-config.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L29)
***
### params? [#params]
```ts
readonly optional params?: Readonly;
```
Defined in: [packages/client/src/radio/radio-config.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L32)
***
### txPower? [#txpower]
```ts
readonly optional txPower?: number;
```
Defined in: [packages/client/src/radio/radio-config.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L31)
## Methods [#methods]
### diff() [#diff]
```ts
diff(self): RadioSetting[];
```
Defined in: [packages/client/src/radio/radio-config.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L56)
#### Parameters [#parameters-1]
##### self [#self]
[`SelfInfo`](../interfaces/SelfInfo.md)
What the radio reports
#### Returns [#returns-1]
[`RadioSetting`](../type-aliases/RadioSetting.md)\[]
# RadioConfigError (/docs/client/reference/classes/RadioConfigError)
Defined in: [packages/client/src/errors.ts:261](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L261)
Thrown by `login()` when the radio refuses a setting from the `RadioConfig` applied at startup.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new RadioConfigError(
setting,
message,
radioCode?,
options?
): RadioConfigError;
```
Defined in: [packages/client/src/errors.ts:271](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L271)
#### Parameters [#parameters]
##### setting [#setting]
[`RadioSetting`](../type-aliases/RadioSetting.md)
name, location, txPower or params
##### message [#message]
`string`
Human readable detail
##### radioCode? [#radiocode]
`number` | `null`
Error code sent by the radio, or null
##### options? [#options]
`ErrorOptions`
cause
#### Returns [#returns]
`RadioConfigError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### radioCode [#radiocode-1]
```ts
readonly radioCode: number | null;
```
Defined in: [packages/client/src/errors.ts:263](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L263)
***
### setting [#setting-1]
```ts
readonly setting: RadioSetting;
```
Defined in: [packages/client/src/errors.ts:262](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L262)
# RadioError (/docs/client/reference/classes/RadioError)
Defined in: [packages/client/src/errors.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L61)
Thrown when the radio rejects a Companion command with an error code.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new RadioError(
command,
radioCode,
detail?
): RadioError;
```
Defined in: [packages/client/src/errors.ts:70](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L70)
#### Parameters [#parameters]
##### command [#command]
`string`
Companion command name
##### radioCode [#radiocode]
`number` | `null`
Error code sent by the radio, or null
##### detail? [#detail]
`string`
Replaces the code label
#### Returns [#returns]
`RadioError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### command [#command-1]
```ts
readonly command: string;
```
Defined in: [packages/client/src/errors.ts:62](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L62)
***
### radioCode [#radiocode-1]
```ts
readonly radioCode: number | null;
```
Defined in: [packages/client/src/errors.ts:63](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L63)
# RateLimitError (/docs/client/reference/classes/RateLimitError)
Defined in: [packages/client/src/errors.ts:154](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L154)
Thrown when a fixed outbound limit is reached: `CHANNEL_SEND_LIMIT` parts per `CHANNEL_SEND_WINDOW_MS` on
one channel, or one flood advert per `ADVERT_FLOOD_INTERVAL_MS`. Nothing is queued: retry after `retryAfterMs`.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new RateLimitError(
resource,
channel,
limit,
windowMs,
retryAfterMs
): RateLimitError;
```
Defined in: [packages/client/src/errors.ts:168](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L168)
#### Parameters [#parameters]
##### resource [#resource]
[`RateLimitedResource`](../type-aliases/RateLimitedResource.md)
channel or advert
##### channel [#channel]
[`Channel`](./Channel.md) | `null`
The channel, when resource is channel
##### limit [#limit]
`number`
Sends allowed per window
##### windowMs [#windowms]
`number`
Sliding window
##### retryAfterMs [#retryafterms]
`number`
Delay before one send is allowed again
#### Returns [#returns]
`RateLimitError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### channel [#channel-1]
```ts
readonly channel: Channel | null;
```
Defined in: [packages/client/src/errors.ts:156](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L156)
***
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### limit [#limit-1]
```ts
readonly limit: number;
```
Defined in: [packages/client/src/errors.ts:157](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L157)
***
### resource [#resource-1]
```ts
readonly resource: RateLimitedResource;
```
Defined in: [packages/client/src/errors.ts:155](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L155)
***
### retryAfterMs [#retryafterms-1]
```ts
readonly retryAfterMs: number;
```
Defined in: [packages/client/src/errors.ts:159](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L159)
***
### windowMs [#windowms-1]
```ts
readonly windowMs: number;
```
Defined in: [packages/client/src/errors.ts:158](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L158)
# Role (/docs/client/reference/classes/Role)
Defined in: [packages/client/src/permissions/role.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L11)
A registered role: its permissions, its members (resolved from the list or the source, cached), and `invalidate()` to force a re-read.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new Role(client, definition): Role;
```
Defined in: [packages/client/src/permissions/role.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L26)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
##### definition [#definition]
[`RoleDefinition`](../interfaces/RoleDefinition.md)
Built by RoleBuilder
#### Returns [#returns]
`Role`
## Properties [#properties]
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/permissions/role.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L12)
***
### description [#description]
```ts
readonly description: string;
```
Defined in: [packages/client/src/permissions/role.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L14)
***
### name [#name]
```ts
readonly name: string;
```
Defined in: [packages/client/src/permissions/role.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L13)
***
### permissionNames [#permissionnames]
```ts
readonly permissionNames: readonly string[];
```
Defined in: [packages/client/src/permissions/role.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L16)
***
### priority [#priority]
```ts
readonly priority: number;
```
Defined in: [packages/client/src/permissions/role.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L15)
## Methods [#methods]
### fetchMembers() [#fetchmembers]
```ts
fetchMembers(): Promise;
```
Defined in: [packages/client/src/permissions/role.ts:59](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L59)
#### Returns [#returns-1]
`Promise`\<[`ResolvedMember`](../interfaces/ResolvedMember.md)\[]>
***
### has() [#has]
```ts
has(contact): Promise;
```
Defined in: [packages/client/src/permissions/role.ts:67](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L67)
#### Parameters [#parameters-1]
##### contact [#contact]
[`Contact`](./Contact.md)
Contact to look up
#### Returns [#returns-2]
`Promise`\<`boolean`>
***
### invalidate() [#invalidate]
```ts
invalidate(): void;
```
Defined in: [packages/client/src/permissions/role.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L35)
#### Returns [#returns-3]
`void`
***
### toString() [#tostring]
```ts
toString(): string;
```
Defined in: [packages/client/src/permissions/role.ts:71](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L71)
#### Returns [#returns-4]
`string`
# RoleBuilder (/docs/client/reference/classes/RoleBuilder)
Defined in: [packages/client/src/permissions/role-builder.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L47)
What every builder (`CommandBuilder`, `EventBuilder`, …) produces: a `build()` method tagged with its kind.
## Implements [#implements]
* [`Brick`](../interfaces/Brick.md)\<[`RoleDefinition`](../interfaces/RoleDefinition.md)>
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new RoleBuilder(): RoleBuilder;
```
#### Returns [#returns]
`RoleBuilder`
## Properties [#properties]
### \[BRICK] [#brick]
```ts
readonly [BRICK]: "role";
```
Defined in: [packages/client/src/permissions/role-builder.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L48)
#### Implementation of [#implementation-of]
[`Brick`](../interfaces/Brick.md).[`[BRICK]`](../interfaces/Brick.md#brick)
## Accessors [#accessors]
### name [#name]
#### Get Signature [#get-signature]
```ts
get name(): string;
```
Defined in: [packages/client/src/permissions/role-builder.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L56)
##### Returns [#returns-1]
`string`
## Methods [#methods]
### addPermissions() [#addpermissions]
```ts
addPermissions(...permissions): this;
```
Defined in: [packages/client/src/permissions/role-builder.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L79)
#### Parameters [#parameters]
##### permissions [#permissions]
...[`PermissionLike`](../type-aliases/PermissionLike.md)\[]
Permissions granted by the role
#### Returns [#returns-2]
`this`
***
### build() [#build]
```ts
build(): RoleDefinition;
```
Defined in: [packages/client/src/permissions/role-builder.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L94)
#### Returns [#returns-3]
[`RoleDefinition`](../interfaces/RoleDefinition.md)
#### Implementation of [#implementation-of-1]
[`Brick`](../interfaces/Brick.md).[`build`](../interfaces/Brick.md#build)
***
### setDescription() [#setdescription]
```ts
setDescription(description): this;
```
Defined in: [packages/client/src/permissions/role-builder.ts:67](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L67)
#### Parameters [#parameters-1]
##### description [#description]
`string`
Free text for the bot author
#### Returns [#returns-4]
`this`
***
### setMembers() [#setmembers]
```ts
setMembers(source, options?): this;
```
Defined in: [packages/client/src/permissions/role-builder.ts:88](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L88)
#### Parameters [#parameters-2]
##### source [#source]
[`MemberSource`](../type-aliases/MemberSource.md)
Public keys, or a function returning them
##### options? [#options]
cacheTtl in seconds for a function source. Default 0
###### cacheTtl? [#cachettl]
`number`
#### Returns [#returns-5]
`this`
***
### setName() [#setname]
```ts
setName(name): this;
```
Defined in: [packages/client/src/permissions/role-builder.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L61)
#### Parameters [#parameters-3]
##### name [#name-1]
`string`
Unique role name
#### Returns [#returns-6]
`this`
***
### setPriority() [#setpriority]
```ts
setPriority(priority): this;
```
Defined in: [packages/client/src/permissions/role-builder.ts:73](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L73)
#### Parameters [#parameters-4]
##### priority [#priority]
`number`
Unique integer, higher ranks above
#### Returns [#returns-7]
`this`
# RoleManager (/docs/client/reference/classes/RoleManager)
Defined in: [packages/client/src/permissions/permission-manager.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L24)
`client.roles`: the registered roles, by name and in priority order, with the lookups used to check permissions.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new RoleManager(client): RoleManager;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L29)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`RoleManager`
## Properties [#properties]
### client [#client-1]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L25)
## Accessors [#accessors]
### size [#size]
#### Get Signature [#get-signature]
```ts
get size(): number;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L33)
##### Returns [#returns-1]
`number`
## Methods [#methods]
### get() [#get]
```ts
get(name): Role | undefined;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L38)
#### Parameters [#parameters-1]
##### name [#name]
`string`
Role name
#### Returns [#returns-2]
[`Role`](./Role.md) | `undefined`
***
### sorted() [#sorted]
```ts
sorted(): Role[];
```
Defined in: [packages/client/src/permissions/permission-manager.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L43)
#### Returns [#returns-3]
[`Role`](./Role.md)\[]
# SendQueue (/docs/client/reference/classes/SendQueue)
Defined in: [packages/client/src/messages/send-queue.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L61)
The only path to the air: paces transmissions, waits for DM acknowledgements, resends and floods, expires
messages the radio never got to.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new SendQueue(client): SendQueue;
```
Defined in: [packages/client/src/messages/send-queue.ts:74](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L74)
#### Parameters [#parameters]
##### client [#client]
[`Client`](./Client.md)
Owning client
#### Returns [#returns]
`SendQueue`
## Accessors [#accessors]
### idle [#idle]
#### Get Signature [#get-signature]
```ts
get idle(): boolean;
```
Defined in: [packages/client/src/messages/send-queue.ts:82](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L82)
##### Returns [#returns-1]
`boolean`
***
### size [#size]
#### Get Signature [#get-signature-1]
```ts
get size(): number;
```
Defined in: [packages/client/src/messages/send-queue.ts:78](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L78)
##### Returns [#returns-2]
`number`
## Methods [#methods]
### budgetFor() [#budgetfor]
```ts
budgetFor(target, prefix?): number;
```
Defined in: [packages/client/src/messages/send-queue.ts:90](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L90)
#### Parameters [#parameters-1]
##### target [#target]
[`Contact`](./Contact.md) | [`Channel`](./Channel.md)
Contact or channel
##### prefix? [#prefix]
`string` = `''`
Text counted in the budget, like a mention
#### Returns [#returns-3]
`number`
***
### close() [#close]
```ts
close(timeoutMs): Promise;
```
Defined in: [packages/client/src/messages/send-queue.ts:143](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L143)
#### Parameters [#parameters-2]
##### timeoutMs [#timeoutms]
`number`
Time left to flush the queue
#### Returns [#returns-4]
`Promise`\<`void`>
***
### send() [#send]
```ts
send(
target,
content,
options?
): Promise;
```
Defined in: [packages/client/src/messages/send-queue.ts:99](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L99)
#### Parameters [#parameters-3]
##### target [#target-1]
[`Contact`](./Contact.md) | [`Channel`](./Channel.md)
Contact or channel
##### content [#content]
[`MessageContent`](../type-aliases/MessageContent.md)
Text or MessageBuilder
##### options? [#options]
[`SendOptions`](../interfaces/SendOptions.md) = `{}`
mention prefix for channel replies
#### Returns [#returns-5]
`Promise`\<[`SentMessage`](./SentMessage.md)>
# SentMessage (/docs/client/reference/classes/SentMessage)
Defined in: [packages/client/src/messages/sent-message.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L13)
A message handed to `SendQueue`, tracked across its parts until sent, delivered or failed.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new SentMessage(target, parts): SentMessage;
```
Defined in: [packages/client/src/messages/sent-message.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L25)
#### Parameters [#parameters]
##### target [#target]
[`Contact`](./Contact.md) | [`Channel`](./Channel.md)
Contact or channel
##### parts [#parts]
`string`\[]
Texts sent, one per radio message
#### Returns [#returns]
`SentMessage`
## Properties [#properties]
### parts [#parts-1]
```ts
readonly parts: readonly string[];
```
Defined in: [packages/client/src/messages/sent-message.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L15)
***
### target [#target-1]
```ts
readonly target: Contact | Channel;
```
Defined in: [packages/client/src/messages/sent-message.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L14)
## Accessors [#accessors]
### error [#error]
#### Get Signature [#get-signature]
```ts
get error(): DeliveryFailedError | null;
```
Defined in: [packages/client/src/messages/sent-message.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L42)
##### Returns [#returns-1]
[`DeliveryFailedError`](./DeliveryFailedError.md) | `null`
***
### isDM [#isdm]
#### Get Signature [#get-signature-1]
```ts
get isDM(): boolean;
```
Defined in: [packages/client/src/messages/sent-message.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L31)
##### Returns [#returns-2]
`boolean`
***
### status [#status]
#### Get Signature [#get-signature-2]
```ts
get status(): SentMessageStatus;
```
Defined in: [packages/client/src/messages/sent-message.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L35)
##### Returns [#returns-3]
[`SentMessageStatus`](../type-aliases/SentMessageStatus.md)
## Methods [#methods]
### delivered() [#delivered]
```ts
delivered(): Promise;
```
Defined in: [packages/client/src/messages/sent-message.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L46)
#### Returns [#returns-4]
`Promise`\<`void`>
# SerialTransport (/docs/client/reference/classes/SerialTransport)
Defined in: [packages/transports/src/serial.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L35)
Transport over USB serial with the `'<'` / `'>'` framing. Needs `serialport` installed.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<`TransportEvents`>
## Implements [#implements]
* [`Transport`](../interfaces/Transport.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new SerialTransport(options, deps?): SerialTransport;
```
Defined in: [packages/transports/src/serial.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L47)
#### Parameters [#parameters]
##### options [#options]
[`SerialTransportOptions`](../interfaces/SerialTransportOptions.md)
path and baudRate. Default 115200
##### deps? [#deps]
`SerialTransportDeps` = `{}`
Test seam replacing the serialport import
#### Returns [#returns]
`SerialTransport`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Properties [#properties]
### baudRate [#baudrate]
```ts
readonly baudRate: number;
```
Defined in: [packages/transports/src/serial.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L38)
***
### kind [#kind]
```ts
readonly kind: "serial" = 'serial';
```
Defined in: [packages/transports/src/serial.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L36)
#### Implementation of [#implementation-of]
[`Transport`](../interfaces/Transport.md).[`kind`](../interfaces/Transport.md#kind)
***
### path [#path]
```ts
readonly path: string;
```
Defined in: [packages/transports/src/serial.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L37)
## Accessors [#accessors]
### connected [#connected]
#### Get Signature [#get-signature]
```ts
get connected(): boolean;
```
Defined in: [packages/transports/src/serial.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L54)
##### Returns [#returns-1]
`boolean`
#### Implementation of [#implementation-of-1]
[`Transport`](../interfaces/Transport.md).[`connected`](../interfaces/Transport.md#connected)
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/serial.ts:108](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L108)
#### Returns [#returns-2]
`Promise`\<`void`>
#### Implementation of [#implementation-of-2]
[`Transport`](../interfaces/Transport.md).[`close`](../interfaces/Transport.md#close)
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/serial.ts:59](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L59)
#### Parameters [#parameters-1]
##### signal? [#signal]
`AbortSignal`
Aborts the connection attempt
#### Returns [#returns-3]
`Promise`\<`void`>
#### Implementation of [#implementation-of-3]
[`Transport`](../interfaces/Transport.md).[`connect`](../interfaces/Transport.md#connect)
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...`TransportEvents`\[`K`]
Event arguments
#### Returns [#returns-4]
`boolean`
#### Implementation of [#implementation-of-4]
[`Transport`](../interfaces/Transport.md).[`emit`](../interfaces/Transport.md#emit)
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-5]
`number`
#### Implementation of [#implementation-of-5]
[`Transport`](../interfaces/Transport.md).[`listenerCount`](../interfaces/Transport.md#listenercount)
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<`TransportEvents`\[`K`]>
Listener to remove
#### Returns [#returns-6]
`this`
#### Implementation of [#implementation-of-6]
[`Transport`](../interfaces/Transport.md).[`off`](../interfaces/Transport.md#off)
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<`TransportEvents`\[`K`]>
Called with the event arguments
#### Returns [#returns-7]
`this`
#### Implementation of [#implementation-of-7]
[`Transport`](../interfaces/Transport.md).[`on`](../interfaces/Transport.md#on)
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<`TransportEvents`\[`K`]>
Called once with the event arguments
#### Returns [#returns-8]
`this`
#### Implementation of [#implementation-of-8]
[`Transport`](../interfaces/Transport.md).[`once`](../interfaces/Transport.md#once)
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-9]
`this`
#### Implementation of [#implementation-of-9]
[`Transport`](../interfaces/Transport.md).[`removeAllListeners`](../interfaces/Transport.md#removealllisteners)
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/serial.ts:96](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L96)
#### Parameters [#parameters-8]
##### payload [#payload]
`Uint8Array`
Frame payload without framing
#### Returns [#returns-10]
`Promise`\<`void`>
#### Implementation of [#implementation-of-10]
[`Transport`](../interfaces/Transport.md).[`write`](../interfaces/Transport.md#write)
# TcpTransport (/docs/client/reference/classes/TcpTransport)
Defined in: [packages/transports/src/tcp.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L15)
Transport over WiFi (TCP) with the `'<'` / `'>'` framing. Needs nothing installed.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<`TransportEvents`>
## Implements [#implements]
* [`Transport`](../interfaces/Transport.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new TcpTransport(options): TcpTransport;
```
Defined in: [packages/transports/src/tcp.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L24)
#### Parameters [#parameters]
##### options [#options]
[`TcpTransportOptions`](../interfaces/TcpTransportOptions.md)
host and port. Default port 5000
#### Returns [#returns]
`TcpTransport`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Properties [#properties]
### host [#host]
```ts
readonly host: string;
```
Defined in: [packages/transports/src/tcp.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L17)
***
### kind [#kind]
```ts
readonly kind: "tcp" = 'tcp';
```
Defined in: [packages/transports/src/tcp.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L16)
#### Implementation of [#implementation-of]
[`Transport`](../interfaces/Transport.md).[`kind`](../interfaces/Transport.md#kind)
***
### port [#port]
```ts
readonly port: number;
```
Defined in: [packages/transports/src/tcp.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L18)
## Accessors [#accessors]
### connected [#connected]
#### Get Signature [#get-signature]
```ts
get connected(): boolean;
```
Defined in: [packages/transports/src/tcp.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L31)
##### Returns [#returns-1]
`boolean`
#### Implementation of [#implementation-of-1]
[`Transport`](../interfaces/Transport.md).[`connected`](../interfaces/Transport.md#connected)
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/tcp.ts:106](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L106)
#### Returns [#returns-2]
`Promise`\<`void`>
#### Implementation of [#implementation-of-2]
[`Transport`](../interfaces/Transport.md).[`close`](../interfaces/Transport.md#close)
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/tcp.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L36)
#### Parameters [#parameters-1]
##### signal? [#signal]
`AbortSignal`
Aborts the connection attempt
#### Returns [#returns-3]
`Promise`\<`void`>
#### Implementation of [#implementation-of-3]
[`Transport`](../interfaces/Transport.md).[`connect`](../interfaces/Transport.md#connect)
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...`TransportEvents`\[`K`]
Event arguments
#### Returns [#returns-4]
`boolean`
#### Implementation of [#implementation-of-4]
[`Transport`](../interfaces/Transport.md).[`emit`](../interfaces/Transport.md#emit)
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-5]
`number`
#### Implementation of [#implementation-of-5]
[`Transport`](../interfaces/Transport.md).[`listenerCount`](../interfaces/Transport.md#listenercount)
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<`TransportEvents`\[`K`]>
Listener to remove
#### Returns [#returns-6]
`this`
#### Implementation of [#implementation-of-6]
[`Transport`](../interfaces/Transport.md).[`off`](../interfaces/Transport.md#off)
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<`TransportEvents`\[`K`]>
Called with the event arguments
#### Returns [#returns-7]
`this`
#### Implementation of [#implementation-of-7]
[`Transport`](../interfaces/Transport.md).[`on`](../interfaces/Transport.md#on)
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<`TransportEvents`\[`K`]>
Called once with the event arguments
#### Returns [#returns-8]
`this`
#### Implementation of [#implementation-of-8]
[`Transport`](../interfaces/Transport.md).[`once`](../interfaces/Transport.md#once)
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-9]
`this`
#### Implementation of [#implementation-of-9]
[`Transport`](../interfaces/Transport.md).[`removeAllListeners`](../interfaces/Transport.md#removealllisteners)
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/tcp.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L94)
#### Parameters [#parameters-8]
##### payload [#payload]
`Uint8Array`
Frame payload without framing
#### Returns [#returns-10]
`Promise`\<`void`>
#### Implementation of [#implementation-of-10]
[`Transport`](../interfaces/Transport.md).[`write`](../interfaces/Transport.md#write)
# TooFarError (/docs/client/reference/classes/TooFarError)
Defined in: [packages/client/src/errors.ts:192](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L192)
Thrown by `message.reply()` when the message came from further than the client's `maxHops`.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new TooFarError(hopCount, maxHops): TooFarError;
```
Defined in: [packages/client/src/errors.ts:200](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L200)
#### Parameters [#parameters]
##### hopCount [#hopcount]
`number`
Hops the message travelled
##### maxHops [#maxhops]
`number`
The client's limit
#### Returns [#returns]
`TooFarError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### hopCount [#hopcount-1]
```ts
readonly hopCount: number;
```
Defined in: [packages/client/src/errors.ts:193](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L193)
***
### maxHops [#maxhops-1]
```ts
readonly maxHops: number;
```
Defined in: [packages/client/src/errors.ts:194](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L194)
# TypedEmitter<Events> (/docs/client/reference/classes/TypedEmitter)
Defined in: [packages/transports/src/typed-emitter.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L10)
Minimal typed event emitter (`on`, `once`, `off`, `emit`) with no Node dependency, the base of every transport and of the `Client`.
## Extended by [#extended-by]
* [`BleTransport`](./BleTransport.md)
* [`SerialTransport`](./SerialTransport.md)
* [`TcpTransport`](./TcpTransport.md)
* [`Transport`](../interfaces/Transport.md)
* [`Client`](./Client.md)
* [`Radio`](./Radio.md)
## Type Parameters [#type-parameters]
### Events [#events]
`Events` *extends* `EventMap`
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new TypedEmitter(): TypedEmitter;
```
#### Returns [#returns]
`TypedEmitter`\<`Events`>
## Methods [#methods]
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters-1]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters]
##### event [#event]
`K`
Event name
##### args [#args]
...`Events`\[`K`]
Event arguments
#### Returns [#returns-1]
`boolean`
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-2]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-1]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-2]
`number`
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-3]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<`Events`\[`K`]>
Listener to remove
#### Returns [#returns-3]
`this`
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-4]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<`Events`\[`K`]>
Called with the event arguments
#### Returns [#returns-4]
`this`
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-5]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<`Events`\[`K`]>
Called once with the event arguments
#### Returns [#returns-5]
`this`
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-6]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-6]
`this`
# UnsupportedFirmwareError (/docs/client/reference/classes/UnsupportedFirmwareError)
Defined in: [packages/client/src/errors.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L17)
Thrown by `login()` when the radio's Companion protocol version is older than the library requires.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new UnsupportedFirmwareError(firmwareVersion, minimumVersion): UnsupportedFirmwareError;
```
Defined in: [packages/client/src/errors.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L25)
#### Parameters [#parameters]
##### firmwareVersion [#firmwareversion]
`number`
Version reported by the radio
##### minimumVersion [#minimumversion]
`number`
Version the library needs
#### Returns [#returns]
`UnsupportedFirmwareError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### firmwareVersion [#firmwareversion-1]
```ts
readonly firmwareVersion: number;
```
Defined in: [packages/client/src/errors.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L18)
***
### minimumVersion [#minimumversion-1]
```ts
readonly minimumVersion: number;
```
Defined in: [packages/client/src/errors.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L19)
# channelTextBudget() (/docs/client/reference/functions/channelTextBudget)
```ts
function channelTextBudget(selfName, mention?): number;
```
Defined in: [packages/client/src/messages/text.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/text.ts#L7)
Channel text budget in UTF-8 bytes: 160 minus `": "` and an optional reply `mention` prefix.
## Parameters [#parameters]
### selfName [#selfname]
`string`
### mention? [#mention]
`string` = `''`
## Returns [#returns]
`number`
# createConsoleLogger() (/docs/client/reference/functions/createConsoleLogger)
```ts
function createConsoleLogger(level?): Logger;
```
Defined in: [packages/client/src/logger.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L31)
Builds a `Logger` that writes to the console, prefixed `[meshcore.js]`, filtered by `level`. Default `'info'`.
## Parameters [#parameters]
### level? [#level]
[`LogLevel`](../type-aliases/LogLevel.md) = `'info'`
## Returns [#returns]
[`Logger`](../interfaces/Logger.md)
# expectType() (/docs/client/reference/functions/expectType)
```ts
function expectType(type, map): Collector;
```
Defined in: [packages/client/src/radio/radio.ts:69](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L69)
A `Collector` that resolves on the first response frame of `type`, mapped by `map`, and ignores the rest.
For `client.radio.request()` on commands whose answer is a structured frame.
## Type Parameters [#type-parameters]
### T [#t]
`T` *extends*
\| `"ok"`
\| `"err"`
\| `"disabled"`
\| `"contactsStart"`
\| `"contact"`
\| `"endOfContacts"`
\| `"exportContact"`
\| `"selfInfo"`
\| `"sent"`
\| `"contactMessage"`
\| `"channelMessage"`
\| `"currentTime"`
\| `"noMoreMessages"`
\| `"battAndStorage"`
\| `"deviceInfo"`
\| `"channelInfo"`
\| `"advert"`
\| `"pathUpdated"`
\| `"sendConfirmed"`
\| `"msgWaiting"`
\| `"newAdvert"`
\| `"contactDeleted"`
\| `"contactsFull"`
\| `"unknown"`
\| `"malformed"`
### R [#r]
`R`
## Parameters [#parameters]
### type [#type]
`T`
Response frame type (`DecodedFrame['type']`)
### map [#map]
(`frame`) => `R`
Turns that frame into the request's result
## Returns [#returns]
[`Collector`](../type-aliases/Collector.md)\<`R`>
# hashtagChannelSecret() (/docs/client/reference/functions/hashtagChannelSecret)
```ts
function hashtagChannelSecret(name): Uint8Array;
```
Defined in: [packages/client/src/managers/channel-manager.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L9)
Derives the shared secret a hashtag channel (`#name`) uses from its name, SHA-256 truncated to the wire size.
## Parameters [#parameters]
### name [#name]
`string`
## Returns [#returns]
`Uint8Array`
# isBrick() (/docs/client/reference/functions/isBrick)
```ts
function isBrick(value): value is Brick;
```
Defined in: [packages/client/src/bricks/brick.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/bricks/brick.ts#L13)
Whether `value` is a meshcore.js builder instance, for custom loaders.
## Parameters [#parameters]
### value [#value]
`unknown`
## Returns [#returns]
`value is Brick`
# mergeReplies() (/docs/client/reference/functions/mergeReplies)
```ts
function mergeReplies(overrides?): Replies;
```
Defined in: [packages/client/src/commands/replies.ts:154](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L154)
The English defaults with `overrides` applied on top; what `Client` does with its `replies` option.
## Parameters [#parameters]
### overrides? [#overrides]
`Partial`\<[`Replies`](../interfaces/Replies.md)> = `{}`
Texts replacing the English defaults
## Returns [#returns]
[`Replies`](../interfaces/Replies.md)
# Advert (/docs/client/reference/interfaces/Advert)
Defined in: [packages/client/src/managers/contact-manager.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L9)
Payload of the `advert` event: a heard node's key and name, its cached `Contact` if known, and the raw record.
## Properties [#properties]
### contact [#contact]
```ts
contact: Contact | null;
```
Defined in: [packages/client/src/managers/contact-manager.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L12)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/managers/contact-manager.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L11)
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/client/src/managers/contact-manager.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L10)
***
### record [#record]
```ts
record: ContactRecord;
```
Defined in: [packages/client/src/managers/contact-manager.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/contact-manager.ts#L13)
# ArgDefinition (/docs/client/reference/interfaces/ArgDefinition)
Defined in: [packages/client/src/commands/args.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L26)
Built definition of one command argument, produced by `ArgBuilder.build()`.
## Properties [#properties]
### choices [#choices]
```ts
choices: string[];
```
Defined in: [packages/client/src/commands/args.ts:39](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L39)
***
### defaultValue [#defaultvalue]
```ts
defaultValue: unknown;
```
Defined in: [packages/client/src/commands/args.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L32)
***
### description [#description]
```ts
description: string;
```
Defined in: [packages/client/src/commands/args.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L29)
***
### hasDefault [#hasdefault]
```ts
hasDefault: boolean;
```
Defined in: [packages/client/src/commands/args.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L31)
***
### max [#max]
```ts
max: number | null;
```
Defined in: [packages/client/src/commands/args.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L38)
***
### maxLength [#maxlength]
```ts
maxLength: number | null;
```
Defined in: [packages/client/src/commands/args.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L34)
***
### min [#min]
```ts
min: number | null;
```
Defined in: [packages/client/src/commands/args.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L37)
***
### minLength [#minlength]
```ts
minLength: number | null;
```
Defined in: [packages/client/src/commands/args.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L33)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/commands/args.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L28)
***
### pattern [#pattern]
```ts
pattern: RegExp | null;
```
Defined in: [packages/client/src/commands/args.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L35)
***
### required [#required]
```ts
required: boolean;
```
Defined in: [packages/client/src/commands/args.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L30)
***
### rest [#rest]
```ts
rest: boolean;
```
Defined in: [packages/client/src/commands/args.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L36)
***
### type [#type]
```ts
type: ArgType;
```
Defined in: [packages/client/src/commands/args.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L27)
# BleTransportOptions (/docs/client/reference/interfaces/BleTransportOptions)
Defined in: [packages/transports/src/ble.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L48)
Which radio to connect to: by BLE address, by advertised name, or the first Companion found; and how long to scan.
## Properties [#properties]
### address? [#address]
```ts
optional address?: string;
```
Defined in: [packages/transports/src/ble.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L49)
***
### name? [#name]
```ts
optional name?: string;
```
Defined in: [packages/transports/src/ble.ts:50](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L50)
***
### scanTimeoutMs? [#scantimeoutms]
```ts
optional scanTimeoutMs?: number;
```
Defined in: [packages/transports/src/ble.ts:51](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L51)
# Brick<Definition> (/docs/client/reference/interfaces/Brick)
Defined in: [packages/client/src/bricks/brick.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/bricks/brick.ts#L7)
What every builder (`CommandBuilder`, `EventBuilder`, …) produces: a `build()` method tagged with its kind.
## Type Parameters [#type-parameters]
### Definition [#definition]
`Definition` = `unknown`
## Properties [#properties]
### \[BRICK] [#brick]
```ts
readonly [BRICK]: BrickKind;
```
Defined in: [packages/client/src/bricks/brick.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/bricks/brick.ts#L8)
## Methods [#methods]
### build() [#build]
```ts
build(): Definition;
```
Defined in: [packages/client/src/bricks/brick.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/bricks/brick.ts#L9)
#### Returns [#returns]
`Definition`
# ChannelRecord (/docs/client/reference/interfaces/ChannelRecord)
Defined in: [packages/protocol/src/types.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L46)
A channel slot of the radio: index, name and 16-byte secret.
## Properties [#properties]
### index [#index]
```ts
index: number;
```
Defined in: [packages/protocol/src/types.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L47)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/protocol/src/types.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L48)
***
### secret [#secret]
```ts
secret: Uint8Array;
```
Defined in: [packages/protocol/src/types.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L49)
# ClientEvents (/docs/client/reference/interfaces/ClientEvents)
Defined in: [packages/client/src/client/events.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L18)
Every `client.on(...)` event with its arguments.
## Extends [#extends]
* `Record`\<`string`, `unknown`\[]>
## Indexable [#indexable]
```ts
[key: string]: unknown[]
```
## Properties [#properties]
### advert [#advert]
```ts
advert: [Advert];
```
Defined in: [packages/client/src/client/events.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L26)
***
### channelUpdate [#channelupdate]
```ts
channelUpdate: [Channel | null, Channel | null];
```
Defined in: [packages/client/src/client/events.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L31)
***
### commandDenied [#commanddenied]
```ts
commandDenied: [DeniedContext, DenyReason];
```
Defined in: [packages/client/src/client/events.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L34)
***
### commandError [#commanderror]
```ts
commandError: [Error, CommandContext>];
```
Defined in: [packages/client/src/client/events.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L33)
***
### commandRun [#commandrun]
```ts
commandRun: [CommandContext>];
```
Defined in: [packages/client/src/client/events.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L32)
***
### contactAdd [#contactadd]
```ts
contactAdd: [Contact];
```
Defined in: [packages/client/src/client/events.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L27)
***
### contactRemove [#contactremove]
```ts
contactRemove: [Contact];
```
Defined in: [packages/client/src/client/events.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L29)
***
### contactsFull [#contactsfull]
```ts
contactsFull: [];
```
Defined in: [packages/client/src/client/events.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L30)
***
### contactUpdate [#contactupdate]
```ts
contactUpdate: [Contact, Contact];
```
Defined in: [packages/client/src/client/events.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L28)
***
### disconnect [#disconnect]
```ts
disconnect: [Error];
```
Defined in: [packages/client/src/client/events.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L20)
***
### error [#error]
```ts
error: [Error, ErrorSource];
```
Defined in: [packages/client/src/client/events.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L22)
***
### messageCreate [#messagecreate]
```ts
messageCreate: [Message];
```
Defined in: [packages/client/src/client/events.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L23)
***
### messageDelivered [#messagedelivered]
```ts
messageDelivered: [SentMessage];
```
Defined in: [packages/client/src/client/events.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L24)
***
### messageFailed [#messagefailed]
```ts
messageFailed: [SentMessage, DeliveryFailedError];
```
Defined in: [packages/client/src/client/events.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L25)
***
### pluginLoad [#pluginload]
```ts
pluginLoad: [Plugin];
```
Defined in: [packages/client/src/client/events.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L35)
***
### pluginUnload [#pluginunload]
```ts
pluginUnload: [Plugin];
```
Defined in: [packages/client/src/client/events.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L36)
***
### raw [#raw]
```ts
raw: [DecodedFrame];
```
Defined in: [packages/client/src/client/events.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L37)
***
### ready [#ready]
```ts
ready: [];
```
Defined in: [packages/client/src/client/events.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L19)
***
### reconnecting [#reconnecting]
```ts
reconnecting: [number, number];
```
Defined in: [packages/client/src/client/events.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L21)
# ClientOptions (/docs/client/reference/interfaces/ClientOptions)
Defined in: [packages/client/src/client/client.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L42)
Infrastructure for a `Client`: transport, optional radio config, replies override, logger, app name, bricks dir, max hops.
## Properties [#properties]
### appName? [#appname]
```ts
optional appName?: string;
```
Defined in: [packages/client/src/client/client.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L47)
***
### load? [#load]
```ts
optional load?: string | URL;
```
Defined in: [packages/client/src/client/client.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L48)
***
### logger? [#logger]
```ts
optional logger?: Logger;
```
Defined in: [packages/client/src/client/client.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L46)
***
### maxHops? [#maxhops]
```ts
optional maxHops?: number;
```
Defined in: [packages/client/src/client/client.ts:50](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L50)
Ignore commands and refuse `message.reply()` beyond this many hops (`Message.hopCount`). Default: no limit
***
### radio? [#radio]
```ts
optional radio?: RadioConfig;
```
Defined in: [packages/client/src/client/client.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L44)
***
### replies? [#replies]
```ts
optional replies?: Partial;
```
Defined in: [packages/client/src/client/client.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L45)
***
### transport [#transport]
```ts
transport: Transport;
```
Defined in: [packages/client/src/client/client.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L43)
# CommandDefinition (/docs/client/reference/interfaces/CommandDefinition)
Defined in: [packages/client/src/commands/command.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L24)
Built definition of a command, produced by `CommandBuilder.build()`.
## Properties [#properties]
### aliases [#aliases]
```ts
aliases: string[];
```
Defined in: [packages/client/src/commands/command.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L27)
***
### args [#args]
```ts
args: ArgDefinition[];
```
Defined in: [packages/client/src/commands/command.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L28)
***
### cooldownSeconds [#cooldownseconds]
```ts
cooldownSeconds: number;
```
Defined in: [packages/client/src/commands/command.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L30)
***
### core [#core]
```ts
core: boolean;
```
Defined in: [packages/client/src/commands/command.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L36)
***
### description [#description]
```ts
description: string;
```
Defined in: [packages/client/src/commands/command.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L26)
***
### errorHandler [#errorhandler]
```ts
errorHandler: CommandErrorHandler | null;
```
Defined in: [packages/client/src/commands/command.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L35)
***
### handler [#handler]
```ts
handler: CommandHandler;
```
Defined in: [packages/client/src/commands/command.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L33)
***
### maxAgeSeconds [#maxageseconds]
```ts
maxAgeSeconds: number;
```
Defined in: [packages/client/src/commands/command.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L31)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/commands/command.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L25)
***
### requiredPermissions [#requiredpermissions]
```ts
requiredPermissions: string[];
```
Defined in: [packages/client/src/commands/command.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L32)
***
### scopes [#scopes]
```ts
scopes: CommandScope[];
```
Defined in: [packages/client/src/commands/command.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L29)
***
### usageErrorHandler [#usageerrorhandler]
```ts
usageErrorHandler: UsageErrorHandler | null;
```
Defined in: [packages/client/src/commands/command.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L34)
# ContactRecord (/docs/client/reference/interfaces/ContactRecord)
Defined in: [packages/protocol/src/types.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L4)
A contact as stored by the radio: key, kind (`ContactType`), flags, route, name, last advert, location, last modification.
## Properties [#properties]
### flags [#flags]
```ts
flags: number;
```
Defined in: [packages/protocol/src/types.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L7)
***
### lastAdvertTimestamp [#lastadverttimestamp]
```ts
lastAdvertTimestamp: number;
```
Defined in: [packages/protocol/src/types.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L10)
***
### lastModified [#lastmodified]
```ts
lastModified: number;
```
Defined in: [packages/protocol/src/types.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L13)
***
### latitude [#latitude]
```ts
latitude: number;
```
Defined in: [packages/protocol/src/types.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L11)
***
### longitude [#longitude]
```ts
longitude: number;
```
Defined in: [packages/protocol/src/types.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L12)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/protocol/src/types.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L9)
***
### outPath [#outpath]
```ts
outPath: Path | null;
```
Defined in: [packages/protocol/src/types.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L8)
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/protocol/src/types.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L5)
***
### type [#type]
```ts
type: number;
```
Defined in: [packages/protocol/src/types.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L6)
# CreateChannelOptions (/docs/client/reference/interfaces/CreateChannelOptions)
Defined in: [packages/client/src/managers/channel-manager.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L14)
Options for `ChannelManager.create()`. A `#`-prefixed `name` with no `secret` derives one from the name.
## Properties [#properties]
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/managers/channel-manager.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L15)
***
### secret? [#secret]
```ts
optional secret?: Uint8Array;
```
Defined in: [packages/client/src/managers/channel-manager.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/managers/channel-manager.ts#L16)
# DeniedContext (/docs/client/reference/interfaces/DeniedContext)
Defined in: [packages/client/src/commands/context.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L26)
What `commandDenied` hands the listener: the triggering message and, if it matched a name, the `Command`.
## Properties [#properties]
### author [#author]
```ts
readonly author: Author;
```
Defined in: [packages/client/src/commands/context.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L29)
***
### channel [#channel]
```ts
readonly channel: Channel | null;
```
Defined in: [packages/client/src/commands/context.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L30)
***
### client [#client]
```ts
readonly client: Client;
```
Defined in: [packages/client/src/commands/context.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L27)
***
### command [#command]
```ts
readonly command: Command | null;
```
Defined in: [packages/client/src/commands/context.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L32)
***
### isDM [#isdm]
```ts
readonly isDM: boolean;
```
Defined in: [packages/client/src/commands/context.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L31)
***
### message [#message]
```ts
readonly message: Message;
```
Defined in: [packages/client/src/commands/context.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L28)
# DeviceInfo (/docs/client/reference/interfaces/DeviceInfo)
Defined in: [packages/protocol/src/types.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L33)
What `DEVICE_QUERY` returns: firmware version and, on newer firmwares, limits and build details (`null` when absent).
## Properties [#properties]
### blePin [#blepin]
```ts
blePin: number | null;
```
Defined in: [packages/protocol/src/types.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L37)
***
### firmwareBuildDate [#firmwarebuilddate]
```ts
firmwareBuildDate: string | null;
```
Defined in: [packages/protocol/src/types.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L38)
***
### firmwareVersion [#firmwareversion]
```ts
firmwareVersion: number;
```
Defined in: [packages/protocol/src/types.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L34)
***
### firmwareVersionName [#firmwareversionname]
```ts
firmwareVersionName: string | null;
```
Defined in: [packages/protocol/src/types.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L40)
***
### manufacturer [#manufacturer]
```ts
manufacturer: string | null;
```
Defined in: [packages/protocol/src/types.ts:39](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L39)
***
### maxChannels [#maxchannels]
```ts
maxChannels: number | null;
```
Defined in: [packages/protocol/src/types.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L36)
***
### maxContacts [#maxcontacts]
```ts
maxContacts: number | null;
```
Defined in: [packages/protocol/src/types.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L35)
***
### pathHashMode [#pathhashmode]
```ts
pathHashMode: number | null;
```
Defined in: [packages/protocol/src/types.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L42)
***
### repeatEnabled [#repeatenabled]
```ts
repeatEnabled: boolean | null;
```
Defined in: [packages/protocol/src/types.ts:41](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L41)
# ErrorSource (/docs/client/reference/interfaces/ErrorSource)
Defined in: [packages/client/src/client/events.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L12)
Where an error reported through the `error` event originated: which kind of brick, and its name if any.
## Properties [#properties]
### name? [#name]
```ts
optional name?: string;
```
Defined in: [packages/client/src/client/events.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L14)
***
### type [#type]
```ts
type: "command" | "event" | "job" | "plugin" | "internal";
```
Defined in: [packages/client/src/client/events.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/events.ts#L13)
# EventDefinition (/docs/client/reference/interfaces/EventDefinition)
Defined in: [packages/client/src/events/event-builder.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L10)
What an `EventBuilder` builds: the event, whether it fires once, and the handler.
## Properties [#properties]
### event [#event]
```ts
event: string;
```
Defined in: [packages/client/src/events/event-builder.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L11)
***
### handler [#handler]
```ts
handler: (client, ...args) => unknown;
```
Defined in: [packages/client/src/events/event-builder.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L13)
#### Parameters [#parameters]
##### client [#client]
[`Client`](../classes/Client.md)
##### args [#args]
...`unknown`\[]
#### Returns [#returns]
`unknown`
***
### once [#once]
```ts
once: boolean;
```
Defined in: [packages/client/src/events/event-builder.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L12)
# JobDefinition (/docs/client/reference/interfaces/JobDefinition)
Defined in: [packages/client/src/jobs/job-builder.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L25)
What a `JobBuilder` builds: name, schedule, run-on-start, overlap policy, timeout, connection requirement and handler.
## Properties [#properties]
### handler [#handler]
```ts
handler: (client, job) => unknown;
```
Defined in: [packages/client/src/jobs/job-builder.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L32)
#### Parameters [#parameters]
##### client [#client]
[`Client`](../classes/Client.md)
##### job [#job]
[`JobRunInfo`](./JobRunInfo.md)
#### Returns [#returns]
`unknown`
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/jobs/job-builder.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L26)
***
### overlap [#overlap]
```ts
overlap: OverlapPolicy;
```
Defined in: [packages/client/src/jobs/job-builder.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L29)
***
### requiresConnection [#requiresconnection]
```ts
requiresConnection: boolean;
```
Defined in: [packages/client/src/jobs/job-builder.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L31)
***
### runOnStart [#runonstart]
```ts
runOnStart: boolean;
```
Defined in: [packages/client/src/jobs/job-builder.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L28)
***
### schedule [#schedule]
```ts
schedule: JobSchedule;
```
Defined in: [packages/client/src/jobs/job-builder.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L27)
***
### timeoutSeconds [#timeoutseconds]
```ts
timeoutSeconds: number;
```
Defined in: [packages/client/src/jobs/job-builder.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L30)
# JobRunInfo (/docs/client/reference/interfaces/JobRunInfo)
Defined in: [packages/client/src/jobs/job-builder.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L12)
What a job handler receives about the current run: the job name, an abort signal (timeout or shutdown), and the last and next run dates.
## Properties [#properties]
### lastRun [#lastrun]
```ts
readonly lastRun: Date | null;
```
Defined in: [packages/client/src/jobs/job-builder.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L15)
***
### name [#name]
```ts
readonly name: string;
```
Defined in: [packages/client/src/jobs/job-builder.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L13)
***
### nextRun [#nextrun]
```ts
readonly nextRun: Date | null;
```
Defined in: [packages/client/src/jobs/job-builder.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L16)
***
### signal [#signal]
```ts
readonly signal: AbortSignal;
```
Defined in: [packages/client/src/jobs/job-builder.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L14)
# LoadIssue (/docs/client/reference/interfaces/LoadIssue)
Defined in: [packages/client/src/errors.ts:226](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L226)
One problem found while validating or loading a brick: which file and brick, and what was wrong.
## Properties [#properties]
### brick [#brick]
```ts
brick: string;
```
Defined in: [packages/client/src/errors.ts:228](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L228)
***
### file? [#file]
```ts
optional file?: string;
```
Defined in: [packages/client/src/errors.ts:227](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L227)
***
### message [#message]
```ts
message: string;
```
Defined in: [packages/client/src/errors.ts:229](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L229)
# LoadOptions (/docs/client/reference/interfaces/LoadOptions)
Defined in: [packages/client/src/client/loader.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/loader.ts#L14)
Options for `client.load()`. `watch: true` hot-reloads bricks per file as they change on disk.
## Properties [#properties]
### watch? [#watch]
```ts
optional watch?: boolean;
```
Defined in: [packages/client/src/client/loader.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/loader.ts#L15)
# Location (/docs/client/reference/interfaces/Location)
Defined in: [packages/client/src/radio/radio-settings.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L12)
A position in decimal degrees.
## Properties [#properties]
### lat [#lat]
```ts
lat: number;
```
Defined in: [packages/client/src/radio/radio-settings.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L13)
***
### lon [#lon]
```ts
lon: number;
```
Defined in: [packages/client/src/radio/radio-settings.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L14)
# Logger (/docs/client/reference/interfaces/Logger)
Defined in: [packages/client/src/logger.ts:2](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L2)
Logging sink a `Client` writes to; pass a custom one through `ClientOptions.logger` to plug in your own.
## Methods [#methods]
### debug() [#debug]
```ts
debug(message, ...meta): void;
```
Defined in: [packages/client/src/logger.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L7)
#### Parameters [#parameters]
##### message [#message]
`string`
Log line
##### meta [#meta]
...`unknown`\[]
Extra values, like an error
#### Returns [#returns]
`void`
***
### error() [#error]
```ts
error(message, ...meta): void;
```
Defined in: [packages/client/src/logger.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L22)
#### Parameters [#parameters-1]
##### message [#message-1]
`string`
Log line
##### meta [#meta-1]
...`unknown`\[]
Extra values, like an error
#### Returns [#returns-1]
`void`
***
### info() [#info]
```ts
info(message, ...meta): void;
```
Defined in: [packages/client/src/logger.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L12)
#### Parameters [#parameters-2]
##### message [#message-2]
`string`
Log line
##### meta [#meta-2]
...`unknown`\[]
Extra values, like an error
#### Returns [#returns-2]
`void`
***
### warn() [#warn]
```ts
warn(message, ...meta): void;
```
Defined in: [packages/client/src/logger.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L17)
#### Parameters [#parameters-3]
##### message [#message-3]
`string`
Log line
##### meta [#meta-3]
...`unknown`\[]
Extra values, like an error
#### Returns [#returns-3]
`void`
# Member (/docs/client/reference/interfaces/Member)
Defined in: [packages/client/src/permissions/role-builder.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L13)
A role member with its key normalised to lowercase.
## Extended by [#extended-by]
* [`ResolvedMember`](./ResolvedMember.md)
## Properties [#properties]
### key [#key]
```ts
key: string;
```
Defined in: [packages/client/src/permissions/role-builder.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L14)
***
### label? [#label]
```ts
optional label?: string;
```
Defined in: [packages/client/src/permissions/role-builder.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L15)
# MessageData (/docs/client/reference/interfaces/MessageData)
Defined in: [packages/client/src/structures/message.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L19)
Fields a `Message` is built from.
## Properties [#properties]
### author [#author]
```ts
author: Author;
```
Defined in: [packages/client/src/structures/message.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L25)
***
### backlog [#backlog]
```ts
backlog: boolean;
```
Defined in: [packages/client/src/structures/message.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L24)
***
### channel [#channel]
```ts
channel: Channel | null;
```
Defined in: [packages/client/src/structures/message.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L26)
***
### content [#content]
```ts
content: string;
```
Defined in: [packages/client/src/structures/message.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L20)
***
### hopCount [#hopcount]
```ts
hopCount: number | null;
```
Defined in: [packages/client/src/structures/message.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L23)
***
### senderTimestamp [#sendertimestamp]
```ts
senderTimestamp: number;
```
Defined in: [packages/client/src/structures/message.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L21)
***
### snr [#snr]
```ts
snr: number | null;
```
Defined in: [packages/client/src/structures/message.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L22)
# Path (/docs/client/reference/interfaces/Path)
Defined in: [packages/protocol/src/path.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L4)
A route through the mesh: the hash size used and one hash per hop.
## Properties [#properties]
### hashSize [#hashsize]
```ts
hashSize: 1 | 2 | 3;
```
Defined in: [packages/protocol/src/path.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L5)
***
### hops [#hops]
```ts
hops: Uint8Array[];
```
Defined in: [packages/protocol/src/path.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L6)
# Permission (/docs/client/reference/interfaces/Permission)
Defined in: [packages/client/src/permissions/permission-manager.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L10)
A registered permission, as listed by `client.permissions`.
## Properties [#properties]
### description [#description]
```ts
readonly description: string;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L12)
***
### name [#name]
```ts
readonly name: string;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L11)
# PermissionDefinition (/docs/client/reference/interfaces/PermissionDefinition)
Defined in: [packages/client/src/permissions/permission-builder.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L9)
What a `PermissionBuilder` builds: a name and a description.
## Properties [#properties]
### description [#description]
```ts
description: string;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L11)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L10)
# PermissionHolder (/docs/client/reference/interfaces/PermissionHolder)
Defined in: [packages/client/src/permissions/permission-manager.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L16)
Someone holding a role: the public key (or prefix) from the role's members, its optional label, the cached `Contact` if the radio knows it, and the roles it holds.
## Properties [#properties]
### contact [#contact]
```ts
contact: Contact | null;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L19)
***
### key [#key]
```ts
key: string;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L17)
***
### label? [#label]
```ts
optional label?: string;
```
Defined in: [packages/client/src/permissions/permission-manager.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L18)
***
### roles [#roles]
```ts
roles: Role[];
```
Defined in: [packages/client/src/permissions/permission-manager.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-manager.ts#L20)
# PluginDefinition<Options> (/docs/client/reference/interfaces/PluginDefinition)
Defined in: [packages/client/src/plugins/plugin-builder.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L14)
What a `PluginBuilder` builds: name, description, the bricks factory, the options given to `configure()`, and whether it was configured.
## Type Parameters [#type-parameters]
### Options [#options]
`Options` = `unknown`
## Properties [#properties]
### bricks [#bricks]
```ts
bricks: PluginBricksFactory;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L17)
***
### configured [#configured]
```ts
configured: boolean;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L19)
***
### description [#description]
```ts
description: string | undefined;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L16)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L15)
***
### options [#options-1]
```ts
options: Options | undefined;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L18)
# RadioConfigOptions (/docs/client/reference/interfaces/RadioConfigOptions)
Defined in: [packages/client/src/radio/radio-config.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L17)
Fields for `RadioConfig`; every field is optional and, once declared, validated and frozen.
## Properties [#properties]
### location? [#location]
```ts
optional location?: Location;
```
Defined in: [packages/client/src/radio/radio-config.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L19)
***
### name? [#name]
```ts
optional name?: string;
```
Defined in: [packages/client/src/radio/radio-config.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L18)
***
### params? [#params]
```ts
optional params?: RadioParams;
```
Defined in: [packages/client/src/radio/radio-config.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L21)
***
### txPower? [#txpower]
```ts
optional txPower?: number;
```
Defined in: [packages/client/src/radio/radio-config.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L20)
# RadioEvents (/docs/client/reference/interfaces/RadioEvents)
Defined in: [packages/client/src/radio/radio.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L53)
Events a `Radio` emits: `push` for unsolicited firmware pushes, `raw` for every decoded frame.
## Extends [#extends]
* `Record`\<`string`, `unknown`\[]>
## Indexable [#indexable]
```ts
[key: string]: unknown[]
```
## Properties [#properties]
### push [#push]
```ts
push: [PushFrame];
```
Defined in: [packages/client/src/radio/radio.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L54)
***
### raw [#raw]
```ts
raw: [DecodedFrame];
```
Defined in: [packages/client/src/radio/radio.ts:55](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L55)
# RadioOptions (/docs/client/reference/interfaces/RadioOptions)
Defined in: [packages/client/src/radio/radio.ts:59](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L59)
Options for `Radio`: request timeout. Default `timeoutMs` 5000.
## Properties [#properties]
### timeoutMs? [#timeoutms]
```ts
optional timeoutMs?: number;
```
Defined in: [packages/client/src/radio/radio.ts:60](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L60)
# RadioParams (/docs/client/reference/interfaces/RadioParams)
Defined in: [packages/client/src/radio/radio-settings.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L4)
LoRa radio parameters in app units: `frequency` in MHz, `bandwidth` in kHz.
## Properties [#properties]
### bandwidth [#bandwidth]
```ts
bandwidth: number;
```
Defined in: [packages/client/src/radio/radio-settings.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L6)
***
### codingRate [#codingrate]
```ts
codingRate: number;
```
Defined in: [packages/client/src/radio/radio-settings.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L8)
***
### frequency [#frequency]
```ts
frequency: number;
```
Defined in: [packages/client/src/radio/radio-settings.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L5)
***
### spreadingFactor [#spreadingfactor]
```ts
spreadingFactor: number;
```
Defined in: [packages/client/src/radio/radio-settings.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-settings.ts#L7)
# Replies (/docs/client/reference/interfaces/Replies)
Defined in: [packages/client/src/commands/replies.ts:2](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L2)
Every text the bot says on its own: refusals, usage errors, and the answers of the built-in `help`, `plugins` and `jobs` commands. Functions receive what they need to format the reply.
## Properties [#properties]
### internalError [#internalerror]
```ts
internalError: string;
```
Defined in: [packages/client/src/commands/replies.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L5)
***
### missingPermissions [#missingpermissions]
```ts
missingPermissions: string;
```
Defined in: [packages/client/src/commands/replies.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L6)
***
### noCommands [#nocommands]
```ts
noCommands: string;
```
Defined in: [packages/client/src/commands/replies.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L4)
***
### noJobs [#nojobs]
```ts
noJobs: string;
```
Defined in: [packages/client/src/commands/replies.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L54)
***
### noPlugins [#noplugins]
```ts
noPlugins: string;
```
Defined in: [packages/client/src/commands/replies.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L25)
***
### unknownCommandDM [#unknowncommanddm]
```ts
unknownCommandDM: string;
```
Defined in: [packages/client/src/commands/replies.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L3)
***
### unknownJob [#unknownjob]
```ts
unknownJob: string;
```
Defined in: [packages/client/src/commands/replies.ts:73](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L73)
***
### unknownPlugin [#unknownplugin]
```ts
unknownPlugin: string;
```
Defined in: [packages/client/src/commands/replies.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L53)
## Methods [#methods]
### cooldown() [#cooldown]
```ts
cooldown(seconds): string;
```
Defined in: [packages/client/src/commands/replies.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L8)
#### Parameters [#parameters]
##### seconds [#seconds]
`number`
Seconds left
#### Returns [#returns]
`string`
***
### helperChannel() [#helperchannel]
```ts
helperChannel(names): string;
```
Defined in: [packages/client/src/commands/replies.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L24)
One-line helper on a channel: the command names usable there. `names` is never empty.
#### Parameters [#parameters-1]
##### names [#names]
`string`\[]
#### Returns [#returns-1]
`string`
***
### invalidArgument() [#invalidargument]
```ts
invalidArgument(name, usage): string;
```
Defined in: [packages/client/src/commands/replies.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L13)
#### Parameters [#parameters-2]
##### name [#name]
`string`
Argument name
##### usage [#usage]
`string`
Command usage line
#### Returns [#returns-2]
`string`
***
### jobAlreadyPaused() [#jobalreadypaused]
```ts
jobAlreadyPaused(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:70](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L70)
#### Parameters [#parameters-3]
##### name [#name-1]
`string`
Job name
#### Returns [#returns-3]
`string`
***
### jobAlreadyRunning() [#jobalreadyrunning]
```ts
jobAlreadyRunning(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:64](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L64)
#### Parameters [#parameters-4]
##### name [#name-2]
`string`
Job name
#### Returns [#returns-4]
`string`
***
### jobLine() [#jobline]
```ts
jobLine(
name,
state,
nextRun
): string;
```
Defined in: [packages/client/src/commands/replies.ts:60](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L60)
#### Parameters [#parameters-5]
##### name [#name-3]
`string`
Job name
##### state [#state]
`"paused"` | `"scheduled"` | `"running"`
scheduled, paused or running
##### nextRun [#nextrun]
`string` | `null`
HH:MM of the next run, or null
#### Returns [#returns-5]
`string`
***
### jobNotPaused() [#jobnotpaused]
```ts
jobNotPaused(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:72](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L72)
#### Parameters [#parameters-6]
##### name [#name-4]
`string`
Job name
#### Returns [#returns-6]
`string`
***
### jobPaused() [#jobpaused]
```ts
jobPaused(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:66](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L66)
#### Parameters [#parameters-7]
##### name [#name-5]
`string`
Job name
#### Returns [#returns-7]
`string`
***
### jobResumed() [#jobresumed]
```ts
jobResumed(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:68](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L68)
#### Parameters [#parameters-8]
##### name [#name-6]
`string`
Job name
#### Returns [#returns-8]
`string`
***
### jobStarted() [#jobstarted]
```ts
jobStarted(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:62](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L62)
#### Parameters [#parameters-9]
##### name [#name-7]
`string`
Job name
#### Returns [#returns-9]
`string`
***
### missingArgument() [#missingargument]
```ts
missingArgument(name, usage): string;
```
Defined in: [packages/client/src/commands/replies.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L18)
#### Parameters [#parameters-10]
##### name [#name-8]
`string`
Argument name
##### usage [#usage-1]
`string`
Command usage line
#### Returns [#returns-10]
`string`
***
### pluginAlreadyLoaded() [#pluginalreadyloaded]
```ts
pluginAlreadyLoaded(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L45)
#### Parameters [#parameters-11]
##### name [#name-9]
`string`
Plugin name
#### Returns [#returns-11]
`string`
***
### pluginAlreadyUnloaded() [#pluginalreadyunloaded]
```ts
pluginAlreadyUnloaded(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L47)
#### Parameters [#parameters-12]
##### name [#name-10]
`string`
Plugin name
#### Returns [#returns-12]
`string`
***
### pluginFailed() [#pluginfailed]
```ts
pluginFailed(name, issue): string;
```
Defined in: [packages/client/src/commands/replies.ts:52](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L52)
#### Parameters [#parameters-13]
##### name [#name-11]
`string`
Plugin name
##### issue [#issue]
`string`
First problem found
#### Returns [#returns-13]
`string`
***
### pluginLine() [#pluginline]
```ts
pluginLine(
name,
loaded,
count
): string;
```
Defined in: [packages/client/src/commands/replies.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L31)
#### Parameters [#parameters-14]
##### name [#name-12]
`string`
Plugin name
##### loaded [#loaded]
`boolean`
Whether it is loaded
##### count [#count]
`number`
Number of bricks
#### Returns [#returns-14]
`string`
***
### pluginLoaded() [#pluginloaded]
```ts
pluginLoaded(name, count): string;
```
Defined in: [packages/client/src/commands/replies.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L36)
#### Parameters [#parameters-15]
##### name [#name-13]
`string`
Plugin name
##### count [#count-1]
`number`
Number of bricks
#### Returns [#returns-15]
`string`
***
### pluginReloaded() [#pluginreloaded]
```ts
pluginReloaded(name, count): string;
```
Defined in: [packages/client/src/commands/replies.ts:41](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L41)
#### Parameters [#parameters-16]
##### name [#name-14]
`string`
Plugin name
##### count [#count-2]
`number`
Number of bricks
#### Returns [#returns-16]
`string`
***
### pluginUnloaded() [#pluginunloaded]
```ts
pluginUnloaded(name): string;
```
Defined in: [packages/client/src/commands/replies.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L43)
#### Parameters [#parameters-17]
##### name [#name-15]
`string`
Plugin name
#### Returns [#returns-17]
`string`
***
### tooManyArguments() [#toomanyarguments]
```ts
tooManyArguments(usage): string;
```
Defined in: [packages/client/src/commands/replies.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L20)
#### Parameters [#parameters-18]
##### usage [#usage-2]
`string`
Command usage line
#### Returns [#returns-18]
`string`
***
### usage() [#usage-3]
```ts
usage(usage): string;
```
Defined in: [packages/client/src/commands/replies.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L22)
#### Parameters [#parameters-19]
##### usage [#usage-4]
`string`
Command usage line
#### Returns [#returns-19]
`string`
# ResolvedMember (/docs/client/reference/interfaces/ResolvedMember)
Defined in: [packages/client/src/permissions/role.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L6)
A role member joined with the `Contact` the radio knows for its key, if any.
## Extends [#extends]
* [`Member`](./Member.md)
## Properties [#properties]
### contact [#contact]
```ts
contact: Contact | null;
```
Defined in: [packages/client/src/permissions/role.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role.ts#L7)
***
### key [#key]
```ts
key: string;
```
Defined in: [packages/client/src/permissions/role-builder.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L14)
#### Inherited from [#inherited-from]
[`Member`](./Member.md).[`key`](./Member.md#key)
***
### label? [#label]
```ts
optional label?: string;
```
Defined in: [packages/client/src/permissions/role-builder.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L15)
#### Inherited from [#inherited-from-1]
[`Member`](./Member.md).[`label`](./Member.md#label)
# RoleDefinition (/docs/client/reference/interfaces/RoleDefinition)
Defined in: [packages/client/src/permissions/role-builder.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L19)
What a `RoleBuilder` builds: name, description, priority, permission names, members (list or source) and the cache TTL of a member source.
## Properties [#properties]
### cacheTtlSeconds [#cachettlseconds]
```ts
cacheTtlSeconds: number;
```
Defined in: [packages/client/src/permissions/role-builder.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L25)
***
### description [#description]
```ts
description: string;
```
Defined in: [packages/client/src/permissions/role-builder.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L21)
***
### members [#members]
```ts
members:
| Member[]
| (() =>
| MemberList
| Promise);
```
Defined in: [packages/client/src/permissions/role-builder.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L24)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/client/src/permissions/role-builder.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L20)
***
### permissions [#permissions]
```ts
permissions: string[];
```
Defined in: [packages/client/src/permissions/role-builder.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L23)
***
### priority [#priority]
```ts
priority: number;
```
Defined in: [packages/client/src/permissions/role-builder.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L22)
# SelfInfo (/docs/client/reference/interfaces/SelfInfo)
Defined in: [packages/protocol/src/types.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L17)
What the radio says about itself at `APP_START`: key, name, power, location, radio parameters and policies.
## Properties [#properties]
### advertLocationPolicy [#advertlocationpolicy]
```ts
advertLocationPolicy: number;
```
Defined in: [packages/protocol/src/types.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L25)
***
### advertType [#adverttype]
```ts
advertType: number;
```
Defined in: [packages/protocol/src/types.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L18)
***
### latitude [#latitude]
```ts
latitude: number;
```
Defined in: [packages/protocol/src/types.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L22)
***
### longitude [#longitude]
```ts
longitude: number;
```
Defined in: [packages/protocol/src/types.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L23)
***
### manualAddContacts [#manualaddcontacts]
```ts
manualAddContacts: boolean;
```
Defined in: [packages/protocol/src/types.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L27)
***
### maxTxPowerDbm [#maxtxpowerdbm]
```ts
maxTxPowerDbm: number;
```
Defined in: [packages/protocol/src/types.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L20)
***
### multiAcks [#multiacks]
```ts
multiAcks: number;
```
Defined in: [packages/protocol/src/types.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L24)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/protocol/src/types.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L29)
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/protocol/src/types.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L21)
***
### radio [#radio]
```ts
radio: object;
```
Defined in: [packages/protocol/src/types.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L28)
#### bandwidthHz [#bandwidthhz]
```ts
bandwidthHz: number;
```
#### codingRate [#codingrate]
```ts
codingRate: number;
```
#### frequencyKhz [#frequencykhz]
```ts
frequencyKhz: number;
```
#### spreadingFactor [#spreadingfactor]
```ts
spreadingFactor: number;
```
***
### telemetryModes [#telemetrymodes]
```ts
telemetryModes: object;
```
Defined in: [packages/protocol/src/types.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L26)
#### base [#base]
```ts
base: number;
```
#### environment [#environment]
```ts
environment: number;
```
#### location [#location]
```ts
location: number;
```
***
### txPowerDbm [#txpowerdbm]
```ts
txPowerDbm: number;
```
Defined in: [packages/protocol/src/types.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L19)
# SendOptions (/docs/client/reference/interfaces/SendOptions)
Defined in: [packages/client/src/messages/send-queue.ts:51](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L51)
Options for `SendQueue.send()`: an extra `prefix` (a mention) counted in the target's byte budget.
`allowPublic` is set by the command pipeline only.
## Properties [#properties]
### prefix? [#prefix]
```ts
optional prefix?: string;
```
Defined in: [packages/client/src/messages/send-queue.ts:52](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L52)
# SerialTransportOptions (/docs/client/reference/interfaces/SerialTransportOptions)
Defined in: [packages/transports/src/serial.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L24)
The serial device (`/dev/ttyACM0`, `COM3`) and its baud rate (default 115200).
## Properties [#properties]
### baudRate? [#baudrate]
```ts
optional baudRate?: number;
```
Defined in: [packages/transports/src/serial.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L26)
***
### path [#path]
```ts
path: string;
```
Defined in: [packages/transports/src/serial.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L25)
# TcpTransportOptions (/docs/client/reference/interfaces/TcpTransportOptions)
Defined in: [packages/transports/src/tcp.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L8)
The radio's host, its port (default 5000) and the connect timeout.
## Properties [#properties]
### connectTimeoutMs? [#connecttimeoutms]
```ts
optional connectTimeoutMs?: number;
```
Defined in: [packages/transports/src/tcp.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L11)
***
### host [#host]
```ts
host: string;
```
Defined in: [packages/transports/src/tcp.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L9)
***
### port? [#port]
```ts
optional port?: number;
```
Defined in: [packages/transports/src/tcp.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L10)
# Transport (/docs/client/reference/interfaces/Transport)
Defined in: [packages/transports/src/transport.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/transport.ts#L13)
What the `Client` talks to the radio through: connect, write one frame payload, receive `frame` events, and `close`. Transports add and strip the framing of their medium; reconnection and protocol belong to the client.
## Extends [#extends]
* [`TypedEmitter`](../classes/TypedEmitter.md)\<`TransportEvents`>
## Properties [#properties]
### connected [#connected]
```ts
readonly connected: boolean;
```
Defined in: [packages/transports/src/transport.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/transport.ts#L15)
***
### kind [#kind]
```ts
readonly kind: TransportKind;
```
Defined in: [packages/transports/src/transport.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/transport.ts#L14)
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/transport.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/transport.ts#L18)
#### Returns [#returns]
`Promise`\<`void`>
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/transport.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/transport.ts#L16)
#### Parameters [#parameters]
##### signal? [#signal]
`AbortSignal`
#### Returns [#returns-1]
`Promise`\<`void`>
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-1]
##### event [#event]
`K`
Event name
##### args [#args]
...`TransportEvents`\[`K`]
Event arguments
#### Returns [#returns-2]
`boolean`
#### Inherited from [#inherited-from]
[`TypedEmitter`](../classes/TypedEmitter.md).[`emit`](../classes/TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-3]
`number`
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](../classes/TypedEmitter.md).[`listenerCount`](../classes/TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<`TransportEvents`\[`K`]>
Listener to remove
#### Returns [#returns-4]
`this`
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](../classes/TypedEmitter.md).[`off`](../classes/TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<`TransportEvents`\[`K`]>
Called with the event arguments
#### Returns [#returns-5]
`this`
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](../classes/TypedEmitter.md).[`on`](../classes/TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<`TransportEvents`\[`K`]>
Called once with the event arguments
#### Returns [#returns-6]
`this`
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](../classes/TypedEmitter.md).[`once`](../classes/TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-7]
`this`
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](../classes/TypedEmitter.md).[`removeAllListeners`](../classes/TypedEmitter.md#removealllisteners)
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/transport.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/transport.ts#L17)
#### Parameters [#parameters-7]
##### payload [#payload]
`Uint8Array`
#### Returns [#returns-8]
`Promise`\<`void`>
# UnverifiedAuthor (/docs/client/reference/interfaces/UnverifiedAuthor)
Defined in: [packages/client/src/structures/message.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L10)
A channel message's author when it is not a known contact: only the name from the wire text, unverified.
## Properties [#properties]
### name [#name]
```ts
readonly name: string;
```
Defined in: [packages/client/src/structures/message.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L11)
***
### verified [#verified]
```ts
readonly verified: false;
```
Defined in: [packages/client/src/structures/message.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L12)
# ArgType (/docs/client/reference/type-aliases/ArgType)
```ts
type ArgType =
| "string"
| "integer"
| "number"
| "boolean"
| "choice"
| "contact"
| "channel"
| "role";
```
Defined in: [packages/client/src/commands/args.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L6)
Kinds of command argument a `CommandBuilder.addArg()` chain can declare.
# ArgValue<T, C> (/docs/client/reference/type-aliases/ArgValue)
```ts
type ArgValue = T extends "string" ? string : T extends "integer" | "number" ? number : T extends "boolean" ? boolean : T extends "choice" ? C : T extends "contact" ? Contact : T extends "channel" ? Channel : T extends "role" ? Role : never;
```
Defined in: [packages/client/src/commands/args.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/args.ts#L9)
The parsed TypeScript type for an argument of a given `ArgType` (and its `choice` union `C`).
## Type Parameters [#type-parameters]
### T [#t]
`T` *extends* [`ArgType`](./ArgType.md)
### C [#c]
`C` *extends* `string` = `string`
# Author (/docs/client/reference/type-aliases/Author)
```ts
type Author =
| Contact
| UnverifiedAuthor;
```
Defined in: [packages/client/src/structures/message.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/message.ts#L16)
Who sent a `Message`: a known `Contact`, or an `UnverifiedAuthor` for an unrecognised channel sender.
# BrickKind (/docs/client/reference/type-aliases/BrickKind)
```ts
type BrickKind = "permission" | "role" | "command" | "event" | "job" | "plugin";
```
Defined in: [packages/client/src/bricks/brick.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/bricks/brick.ts#L4)
Which kind of builder a `Brick` is, matching its scan folder (`permissions/`, `roles/`, `commands/`, …).
# ClientStatus (/docs/client/reference/type-aliases/ClientStatus)
```ts
type ClientStatus = "idle" | "connecting" | "ready" | "reconnecting" | "destroyed";
```
Defined in: [packages/client/src/client/client.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L54)
Lifecycle state of a `Client`, from construction to `destroy()`.
# Collector<T> (/docs/client/reference/type-aliases/Collector)
```ts
type Collector = (frame) =>
| {
value: T;
}
| "continue"
| "ignore";
```
Defined in: [packages/client/src/radio/request-queue.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/request-queue.ts#L8)
Decides what a request does with each response frame: `{ value }` resolves it, `'continue'` keeps waiting
(multi-frame answers), `'ignore'` leaves the frame to others.
## Type Parameters [#type-parameters]
### T [#t]
`T`
## Parameters [#parameters]
### frame [#frame]
[`DecodedFrame`](./DecodedFrame.md)
## Returns [#returns]
\| \{
`value`: `T`;
}
\| `"continue"`
\| `"ignore"`
# CommandErrorHandler (/docs/client/reference/type-aliases/CommandErrorHandler)
```ts
type CommandErrorHandler = (ctx, error) => string | MessageBuilder;
```
Defined in: [packages/client/src/commands/command.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L21)
`CommandBuilder.setErrorHandler()`'s callback, run when the handler throws.
## Parameters [#parameters]
### ctx [#ctx]
[`CommandContext`](../classes/CommandContext.md)\<`any`>
### error [#error]
`unknown`
## Returns [#returns]
`string` | [`MessageBuilder`](../classes/MessageBuilder.md)
# CommandHandler (/docs/client/reference/type-aliases/CommandHandler)
```ts
type CommandHandler = (ctx) => unknown;
```
Defined in: [packages/client/src/commands/command.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L15)
`CommandBuilder.setHandler()`'s callback, run once trigger, scope, permissions and cooldown pass.
## Parameters [#parameters]
### ctx [#ctx]
[`CommandContext`](../classes/CommandContext.md)\<`any`>
## Returns [#returns]
`unknown`
# CommandScope (/docs/client/reference/type-aliases/CommandScope)
```ts
type CommandScope = "dm" | "channel" | "public";
```
Defined in: [packages/client/src/commands/command.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L11)
Where a command may be triggered: a direct message, a channel other than Public, or the Public channel.
Public is never included by default — a command must opt in with `setScope('public')`.
# ContactKind (/docs/client/reference/type-aliases/ContactKind)
```ts
type ContactKind = "none" | "chat" | "repeater" | "room" | "sensor";
```
Defined in: [packages/client/src/structures/contact.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/structures/contact.ts#L7)
What kind of node a `Contact` is, decoded from the radio's contact type.
# DecodedFrame (/docs/client/reference/type-aliases/DecodedFrame)
```ts
type DecodedFrame = ResponseFrame | PushFrame | UnknownFrame | MalformedFrame;
```
Defined in: [packages/protocol/src/types.ts:239](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L239)
What `decodeFrame()` returns: a response, a push, or an `unknown` / `malformed` frame.
# DeliveryFailureReason (/docs/client/reference/type-aliases/DeliveryFailureReason)
```ts
type DeliveryFailureReason = "noAck" | "expired" | "radio" | "destroyed";
```
Defined in: [packages/client/src/errors.ts:208](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L208)
Why a DM delivery failed: no ACK after retries, expired in the queue, a radio error, or the client was destroyed.
# DenyReason (/docs/client/reference/type-aliases/DenyReason)
```ts
type DenyReason =
| {
name: string;
type: "unknownCommand";
}
| {
hopCount: number;
type: "tooFar";
}
| {
type: "scope";
}
| {
ageSeconds: number;
type: "backlog";
}
| {
type: "channelUntrusted";
}
| {
missing: Permission[];
type: "missingPermissions";
}
| {
remainingSeconds: number;
type: "cooldown";
}
| {
error: Error;
type: "invalidArguments";
};
```
Defined in: [packages/client/src/commands/context.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/context.ts#L15)
Why a command was refused; every refusal emits `commandDenied` with one of these.
# EventName (/docs/client/reference/type-aliases/EventName)
```ts
type EventName = keyof ClientEvents & string;
```
Defined in: [packages/client/src/events/event-builder.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/events/event-builder.ts#L7)
The name of a `Client` event an `EventBuilder` can listen to.
# JobSchedule (/docs/client/reference/type-aliases/JobSchedule)
```ts
type JobSchedule =
| {
expression: string;
timezone: string | undefined;
type: "cron";
}
| {
seconds: number;
type: "interval";
};
```
Defined in: [packages/client/src/jobs/job-builder.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L20)
When a job runs: a cron expression (with optional IANA timezone) or a fixed interval in seconds.
# LogLevel (/docs/client/reference/type-aliases/LogLevel)
```ts
type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
```
Defined in: [packages/client/src/logger.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L26)
Minimum severity a `Logger` prints; `'silent'` prints nothing.
# MemberInput (/docs/client/reference/type-aliases/MemberInput)
```ts
type MemberInput =
| string
| {
key: string;
label?: string;
};
```
Defined in: [packages/client/src/permissions/role-builder.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L6)
One member of a role: a public key (full, or a prefix of 12 hex characters or more), optionally with a label.
# MemberList (/docs/client/reference/type-aliases/MemberList)
```ts
type MemberList = Iterable;
```
Defined in: [packages/client/src/permissions/role-builder.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L8)
The members of a role, as given to `setMembers()`.
# MemberSource (/docs/client/reference/type-aliases/MemberSource)
```ts
type MemberSource =
| MemberList
| (() =>
| MemberList
| Promise);
```
Defined in: [packages/client/src/permissions/role-builder.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/role-builder.ts#L10)
Where a role's members come from: a fixed list, or a function returning one (sync or async), re-read after `cacheTtl` or `invalidate()`.
# MessageContent (/docs/client/reference/type-aliases/MessageContent)
```ts
type MessageContent = string | MessageBuilder;
```
Defined in: [packages/client/src/messages/send-queue.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L18)
What `contact.send()`, `channel.send()`, `ctx.reply()` and `SendQueue.send()` accept.
# OverflowMode (/docs/client/reference/type-aliases/OverflowMode)
```ts
type OverflowMode = "error" | "truncate" | "split";
```
Defined in: [packages/client/src/builders/message-builder.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L6)
How `MessageBuilder.build()` handles text over budget: refuse, truncate, or split into numbered parts.
# OverlapPolicy (/docs/client/reference/type-aliases/OverlapPolicy)
```ts
type OverlapPolicy = "skip" | "queue";
```
Defined in: [packages/client/src/jobs/job-builder.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/jobs/job-builder.ts#L9)
What happens when a job fires while its previous run is still going: `skip` drops the tick, `queue` runs it right after.
# PermissionLike (/docs/client/reference/type-aliases/PermissionLike)
```ts
type PermissionLike =
| PermissionBuilder
| string
| {
name: string;
};
```
Defined in: [packages/client/src/permissions/permission-builder.ts:69](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L69)
Anything that names a permission: a `PermissionBuilder`, an object with a `name`, or the name itself.
# PluginBricksFactory<Options> (/docs/client/reference/type-aliases/PluginBricksFactory)
```ts
type PluginBricksFactory = (client, options) =>
| Iterable
| Promise>;
```
Defined in: [packages/client/src/plugins/plugin-builder.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin-builder.ts#L8)
The function a plugin runs to build its bricks, on load and on every reload; receives the client and the plugin's options.
## Type Parameters [#type-parameters]
### Options [#options]
`Options`
## Parameters [#parameters]
### client [#client]
[`Client`](../classes/Client.md)
### options [#options-1]
`Options`
## Returns [#returns]
\| `Iterable`\<[`Brick`](../interfaces/Brick.md)>
\| `Promise`\<`Iterable`\<[`Brick`](../interfaces/Brick.md)>>
# PluginState (/docs/client/reference/type-aliases/PluginState)
```ts
type PluginState = "pending" | "loaded" | "unloaded";
```
Defined in: [packages/client/src/plugins/plugin.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/plugins/plugin.ts#L8)
Where a plugin is: `pending` until `login()` loads it, then `loaded` or `unloaded`.
# RadioSetting (/docs/client/reference/type-aliases/RadioSetting)
```ts
type RadioSetting = "name" | "location" | "txPower" | "params";
```
Defined in: [packages/client/src/radio/radio-config.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio-config.ts#L14)
Which declared field of a `RadioConfig` differs from what the radio reports, per `diff()`.
# RateLimitedResource (/docs/client/reference/type-aliases/RateLimitedResource)
```ts
type RateLimitedResource = "channel" | "advert";
```
Defined in: [packages/client/src/errors.ts:148](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/errors.ts#L148)
What a `RateLimitError` protects: a channel's outbound budget, or the mesh-wide flood advert.
# SentMessageStatus (/docs/client/reference/type-aliases/SentMessageStatus)
```ts
type SentMessageStatus = "queued" | "sent" | "delivered" | "failed";
```
Defined in: [packages/client/src/messages/sent-message.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/sent-message.ts#L6)
Delivery state of a `SentMessage`: queued in `SendQueue`, on the air, DM-acknowledged, or failed.
# UsageErrorHandler (/docs/client/reference/type-aliases/UsageErrorHandler)
```ts
type UsageErrorHandler = (ctx, error) => string | MessageBuilder;
```
Defined in: [packages/client/src/commands/command.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/command.ts#L18)
`CommandBuilder.setUsageErrorHandler()`'s callback, run when argument parsing fails.
## Parameters [#parameters]
### ctx [#ctx]
[`CommandContext`](../classes/CommandContext.md)\<`any`>
### error [#error]
[`ArgumentError`](../classes/ArgumentError.md)
## Returns [#returns]
`string` | [`MessageBuilder`](../classes/MessageBuilder.md)
# ADVERT_FLOOD_INTERVAL_MS (/docs/client/reference/variables/ADVERT_FLOOD_INTERVAL_MS)
```ts
const ADVERT_FLOOD_INTERVAL_MS: number;
```
Defined in: [packages/client/src/radio/radio.ts:93](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/radio/radio.ts#L93)
Minimum delay between two flood adverts (`sendSelfAdvert(true)`), not configurable. Zero-hop adverts are free.
# CHANNEL_SEND_LIMIT (/docs/client/reference/variables/CHANNEL_SEND_LIMIT)
```ts
const CHANNEL_SEND_LIMIT: 10 = 10;
```
Defined in: [packages/client/src/messages/send-queue.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L27)
Parts a channel accepts per `CHANNEL_SEND_WINDOW_MS`; beyond it `send()` rejects with `RateLimitError`. Not configurable.
# CHANNEL_SEND_WINDOW_MS (/docs/client/reference/variables/CHANNEL_SEND_WINDOW_MS)
```ts
const CHANNEL_SEND_WINDOW_MS: number;
```
Defined in: [packages/client/src/messages/send-queue.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L29)
Sliding window of the per-channel outbound limit, not configurable.
# CORE_PERMISSION_PREFIX (/docs/client/reference/variables/CORE_PERMISSION_PREFIX)
```ts
const CORE_PERMISSION_PREFIX: "core." = 'core.';
```
Defined in: [packages/client/src/permissions/permission-builder.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L6)
The prefix of built-in permission names (`core.administrator`, …); user permissions cannot use it.
# DEFAULT_MAX_PARTS (/docs/client/reference/variables/DEFAULT_MAX_PARTS)
```ts
const DEFAULT_MAX_PARTS: 3 = 3;
```
Defined in: [packages/client/src/builders/message-builder.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/builders/message-builder.ts#L9)
Default `maxParts` for `MessageBuilder.setOverflow('split')`.
# DESTROY_FLUSH_TIMEOUT_MS (/docs/client/reference/variables/DESTROY_FLUSH_TIMEOUT_MS)
```ts
const DESTROY_FLUSH_TIMEOUT_MS: 5000 = 5000;
```
Defined in: [packages/client/src/client/client.ts:65](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L65)
How long `destroy()` waits for in-flight sends to flush before closing anyway, not configurable.
# DM_MAX_RESENDS (/docs/client/reference/variables/DM_MAX_RESENDS)
```ts
const DM_MAX_RESENDS: 3 = 3;
```
Defined in: [packages/client/src/messages/send-queue.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L23)
Resend attempts for a direct message before `SendQueue` resets the path and floods once, not configurable.
# DM_TEXT_BUDGET (/docs/client/reference/variables/DM_TEXT_BUDGET)
```ts
const DM_TEXT_BUDGET: number;
```
Defined in: [packages/client/src/messages/text.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/text.ts#L4)
Direct-message text budget in UTF-8 bytes: 158, the firmware's limit from the fourth delivery attempt.
# HEALTH_CHECK_INTERVAL_MS (/docs/client/reference/variables/HEALTH_CHECK_INTERVAL_MS)
```ts
const HEALTH_CHECK_INTERVAL_MS: 60000 = 60_000;
```
Defined in: [packages/client/src/client/client.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L61)
Interval between health-check pings once connected, not configurable.
# HEALTH_CHECK_MAX_FAILURES (/docs/client/reference/variables/HEALTH_CHECK_MAX_FAILURES)
```ts
const HEALTH_CHECK_MAX_FAILURES: 2 = 2;
```
Defined in: [packages/client/src/client/client.ts:63](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L63)
Consecutive health-check failures before a reconnection is triggered, not configurable.
# Permissions (/docs/client/reference/variables/Permissions)
```ts
const Permissions: Readonly<{
Administrator: PermissionBuilder;
ManageChannels: PermissionBuilder;
ManageContacts: PermissionBuilder;
ManageJobs: PermissionBuilder;
ManagePlugins: PermissionBuilder;
ManageRoles: PermissionBuilder;
ViewPermissions: PermissionBuilder;
}>;
```
Defined in: [packages/client/src/permissions/permission-builder.ts:58](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/permissions/permission-builder.ts#L58)
The built-in permissions: `Administrator` implies every other one; the `Manage*` ones gate the built-in commands and the managers.
# RECONNECT_BASE_DELAY_MS (/docs/client/reference/variables/RECONNECT_BASE_DELAY_MS)
```ts
const RECONNECT_BASE_DELAY_MS: 1000 = 1000;
```
Defined in: [packages/client/src/client/client.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L57)
Delay before the first reconnection attempt; doubles on each further failure, not configurable.
# RECONNECT_MAX_DELAY_MS (/docs/client/reference/variables/RECONNECT_MAX_DELAY_MS)
```ts
const RECONNECT_MAX_DELAY_MS: 60000 = 60_000;
```
Defined in: [packages/client/src/client/client.ts:59](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/client/client.ts#L59)
Cap on the exponential reconnection backoff, not configurable.
# Replies (/docs/client/reference/variables/Replies)
```ts
Replies: Replies;
```
Defined in: [packages/client/src/commands/replies.ts:2](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L2)
The default replies (`englishReplies`), under the name of the interface.
# SEND_EXPIRY_MS (/docs/client/reference/variables/SEND_EXPIRY_MS)
```ts
const SEND_EXPIRY_MS: number;
```
Defined in: [packages/client/src/messages/send-queue.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L25)
How long a queued message may wait for the radio before it fails with `DeliveryFailedError`, not configurable.
# SEND_INTERVAL_MS (/docs/client/reference/variables/SEND_INTERVAL_MS)
```ts
const SEND_INTERVAL_MS: 2000 = 2000;
```
Defined in: [packages/client/src/messages/send-queue.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/messages/send-queue.ts#L21)
Minimum time between two transmissions on `SendQueue`, not configurable.
# englishReplies (/docs/client/reference/variables/englishReplies)
```ts
const englishReplies: Replies;
```
Defined in: [packages/client/src/commands/replies.ts:84](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L84)
The default replies, in English.
# frenchReplies (/docs/client/reference/variables/frenchReplies)
```ts
const frenchReplies: Replies;
```
Defined in: [packages/client/src/commands/replies.ts:116](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/commands/replies.ts#L116)
A complete French set of replies, to pass as `replies` to the `Client`.
# silentLogger (/docs/client/reference/variables/silentLogger)
```ts
const silentLogger: Logger;
```
Defined in: [packages/client/src/logger.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/client/src/logger.ts#L43)
A `Logger` that discards everything; the default for `@meshcorejs/testing` bots.
# ByteReader (/docs/protocol/reference/classes/ByteReader)
Defined in: [packages/protocol/src/bytes.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L37)
Sequential little-endian reader over a `Uint8Array`, used by the frame decoders; throws when reading past the end.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ByteReader(bytes): ByteReader;
```
Defined in: [packages/protocol/src/bytes.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L42)
#### Parameters [#parameters]
##### bytes [#bytes]
`Uint8Array`
#### Returns [#returns]
`ByteReader`
## Accessors [#accessors]
### remaining [#remaining]
#### Get Signature [#get-signature]
```ts
get remaining(): number;
```
Defined in: [packages/protocol/src/bytes.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L47)
##### Returns [#returns-1]
`number`
## Methods [#methods]
### bytes() [#bytes-1]
```ts
bytes(count): Uint8Array;
```
Defined in: [packages/protocol/src/bytes.ts:80](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L80)
#### Parameters [#parameters-1]
##### count [#count]
`number`
#### Returns [#returns-2]
`Uint8Array`
***
### fixedString() [#fixedstring]
```ts
fixedString(size): string;
```
Defined in: [packages/protocol/src/bytes.ts:89](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L89)
#### Parameters [#parameters-2]
##### size [#size]
`number`
#### Returns [#returns-3]
`string`
***
### i32() [#i32]
```ts
i32(): number;
```
Defined in: [packages/protocol/src/bytes.ts:76](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L76)
#### Returns [#returns-4]
`number`
***
### i8() [#i8]
```ts
i8(): number;
```
Defined in: [packages/protocol/src/bytes.ts:64](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L64)
#### Returns [#returns-5]
`number`
***
### restString() [#reststring]
```ts
restString(): string;
```
Defined in: [packages/protocol/src/bytes.ts:95](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L95)
#### Returns [#returns-6]
`string`
***
### skip() [#skip]
```ts
skip(count): void;
```
Defined in: [packages/protocol/src/bytes.ts:85](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L85)
#### Parameters [#parameters-3]
##### count [#count-1]
`number`
#### Returns [#returns-7]
`void`
***
### u16() [#u16]
```ts
u16(): number;
```
Defined in: [packages/protocol/src/bytes.ts:68](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L68)
#### Returns [#returns-8]
`number`
***
### u32() [#u32]
```ts
u32(): number;
```
Defined in: [packages/protocol/src/bytes.ts:72](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L72)
#### Returns [#returns-9]
`number`
***
### u8() [#u8]
```ts
u8(): number;
```
Defined in: [packages/protocol/src/bytes.ts:60](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L60)
#### Returns [#returns-10]
`number`
# ByteWriter (/docs/protocol/reference/classes/ByteWriter)
Defined in: [packages/protocol/src/bytes.ts:101](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L101)
Growable little-endian writer producing a `Uint8Array`, used by the command and response encoders.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ByteWriter(): ByteWriter;
```
#### Returns [#returns]
`ByteWriter`
## Methods [#methods]
### bytes() [#bytes]
```ts
bytes(bytes): this;
```
Defined in: [packages/protocol/src/bytes.ts:123](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L123)
#### Parameters [#parameters]
##### bytes [#bytes-1]
`Uint8Array`
#### Returns [#returns-1]
`this`
***
### fixedString() [#fixedstring]
```ts
fixedString(text, size): this;
```
Defined in: [packages/protocol/src/bytes.ts:133](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L133)
#### Parameters [#parameters-1]
##### text [#text]
`string`
##### size [#size]
`number`
#### Returns [#returns-2]
`this`
***
### i32() [#i32]
```ts
i32(value): this;
```
Defined in: [packages/protocol/src/bytes.ts:119](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L119)
#### Parameters [#parameters-2]
##### value [#value]
`number`
#### Returns [#returns-3]
`this`
***
### string() [#string]
```ts
string(text): this;
```
Defined in: [packages/protocol/src/bytes.ts:141](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L141)
#### Parameters [#parameters-3]
##### text [#text-1]
`string`
#### Returns [#returns-4]
`this`
***
### toBytes() [#tobytes]
```ts
toBytes(): Uint8Array;
```
Defined in: [packages/protocol/src/bytes.ts:145](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L145)
#### Returns [#returns-5]
`Uint8Array`
***
### u16() [#u16]
```ts
u16(value): this;
```
Defined in: [packages/protocol/src/bytes.ts:109](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L109)
#### Parameters [#parameters-4]
##### value [#value-1]
`number`
#### Returns [#returns-6]
`this`
***
### u32() [#u32]
```ts
u32(value): this;
```
Defined in: [packages/protocol/src/bytes.ts:114](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L114)
#### Parameters [#parameters-5]
##### value [#value-2]
`number`
#### Returns [#returns-7]
`this`
***
### u8() [#u8]
```ts
u8(value): this;
```
Defined in: [packages/protocol/src/bytes.ts:104](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L104)
#### Parameters [#parameters-6]
##### value [#value-3]
`number`
#### Returns [#returns-8]
`this`
***
### zeros() [#zeros]
```ts
zeros(count): this;
```
Defined in: [packages/protocol/src/bytes.ts:128](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L128)
#### Parameters [#parameters-7]
##### count [#count]
`number`
#### Returns [#returns-9]
`this`
# FrameDecoder (/docs/protocol/reference/classes/FrameDecoder)
Defined in: [packages/protocol/src/framing.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L35)
Reassemble serial/TCP frames from a byte stream: feed chunks, get complete payloads; bytes before a marker are skipped.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new FrameDecoder(direction?): FrameDecoder;
```
Defined in: [packages/protocol/src/framing.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L42)
#### Parameters [#parameters]
##### direction? [#direction]
[`FrameDirection`](../type-aliases/FrameDirection.md) = `'fromRadio'`
Marker expected. Default fromRadio
#### Returns [#returns]
`FrameDecoder`
## Methods [#methods]
### push() [#push]
```ts
push(chunk): Uint8Array[];
```
Defined in: [packages/protocol/src/framing.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L47)
#### Parameters [#parameters-1]
##### chunk [#chunk]
`Uint8Array`
Bytes received, any split
#### Returns [#returns-1]
`Uint8Array`\<`ArrayBufferLike`>\[]
***
### reset() [#reset]
```ts
reset(): void;
```
Defined in: [packages/protocol/src/framing.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L79)
#### Returns [#returns-2]
`void`
# AdvertPush (/docs/protocol/reference/interfaces/AdvertPush)
Defined in: [packages/protocol/src/types.ts:158](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L158)
`Advert` push: a known contact advertised again.
## Extends [#extends]
* `PushBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "push";
```
Defined in: [packages/protocol/src/types.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L57)
#### Inherited from [#inherited-from]
```ts
PushBase.kind
```
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/protocol/src/types.ts:160](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L160)
***
### type [#type]
```ts
type: "advert";
```
Defined in: [packages/protocol/src/types.ts:159](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L159)
# BattAndStorageFrame (/docs/protocol/reference/interfaces/BattAndStorageFrame)
Defined in: [packages/protocol/src/types.ts:140](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L140)
`BattAndStorage` response: battery millivolts and storage usage.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### batteryMillivolts [#batterymillivolts]
```ts
batteryMillivolts: number;
```
Defined in: [packages/protocol/src/types.ts:142](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L142)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### storageTotalKb [#storagetotalkb]
```ts
storageTotalKb: number | null;
```
Defined in: [packages/protocol/src/types.ts:144](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L144)
***
### storageUsedKb [#storageusedkb]
```ts
storageUsedKb: number | null;
```
Defined in: [packages/protocol/src/types.ts:143](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L143)
***
### type [#type]
```ts
type: "battAndStorage";
```
Defined in: [packages/protocol/src/types.ts:141](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L141)
# ChannelInfoFrame (/docs/protocol/reference/interfaces/ChannelInfoFrame)
Defined in: [packages/protocol/src/types.ts:152](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L152)
`ChannelInfo` response to `GET_CHANNEL`.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### channel [#channel]
```ts
channel: ChannelRecord;
```
Defined in: [packages/protocol/src/types.ts:154](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L154)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "channelInfo";
```
Defined in: [packages/protocol/src/types.ts:153](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L153)
# ChannelMessageFrame (/docs/protocol/reference/interfaces/ChannelMessageFrame)
Defined in: [packages/protocol/src/types.ts:119](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L119)
A received channel message: channel index, route info and text.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### channelIndex [#channelindex]
```ts
channelIndex: number;
```
Defined in: [packages/protocol/src/types.ts:123](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L123)
***
### hopCount [#hopcount]
```ts
hopCount: number | null;
```
Defined in: [packages/protocol/src/types.ts:125](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L125)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### pathLen [#pathlen]
```ts
pathLen: number;
```
Defined in: [packages/protocol/src/types.ts:124](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L124)
***
### senderTimestamp [#sendertimestamp]
```ts
senderTimestamp: number;
```
Defined in: [packages/protocol/src/types.ts:127](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L127)
***
### snr [#snr]
```ts
snr: number | null;
```
Defined in: [packages/protocol/src/types.ts:122](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L122)
***
### text [#text]
```ts
text: string;
```
Defined in: [packages/protocol/src/types.ts:128](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L128)
***
### txtType [#txttype]
```ts
txtType: number;
```
Defined in: [packages/protocol/src/types.ts:126](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L126)
***
### type [#type]
```ts
type: "channelMessage";
```
Defined in: [packages/protocol/src/types.ts:120](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L120)
***
### version [#version]
```ts
version: 2 | 3;
```
Defined in: [packages/protocol/src/types.ts:121](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L121)
# ChannelRecord (/docs/protocol/reference/interfaces/ChannelRecord)
Defined in: [packages/protocol/src/types.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L46)
A channel slot of the radio: index, name and 16-byte secret.
## Properties [#properties]
### index [#index]
```ts
index: number;
```
Defined in: [packages/protocol/src/types.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L47)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/protocol/src/types.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L48)
***
### secret [#secret]
```ts
secret: Uint8Array;
```
Defined in: [packages/protocol/src/types.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L49)
# ContactDeletedPush (/docs/protocol/reference/interfaces/ContactDeletedPush)
Defined in: [packages/protocol/src/types.ts:183](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L183)
`ContactDeleted` push.
## Extends [#extends]
* `PushBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "push";
```
Defined in: [packages/protocol/src/types.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L57)
#### Inherited from [#inherited-from]
```ts
PushBase.kind
```
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/protocol/src/types.ts:185](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L185)
***
### type [#type]
```ts
type: "contactDeleted";
```
Defined in: [packages/protocol/src/types.ts:184](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L184)
# ContactFrame (/docs/protocol/reference/interfaces/ContactFrame)
Defined in: [packages/protocol/src/types.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L79)
`Contact` response: one contact of a listing or of `GET_CONTACT_BY_KEY`.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### contact [#contact]
```ts
contact: ContactRecord;
```
Defined in: [packages/protocol/src/types.ts:81](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L81)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "contact";
```
Defined in: [packages/protocol/src/types.ts:80](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L80)
# ContactMessageFrame (/docs/protocol/reference/interfaces/ContactMessageFrame)
Defined in: [packages/protocol/src/types.ts:106](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L106)
A received direct message: sender prefix, route info, text, and a signature on version 3.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### hopCount [#hopcount]
```ts
hopCount: number | null;
```
Defined in: [packages/protocol/src/types.ts:112](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L112)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### pathLen [#pathlen]
```ts
pathLen: number;
```
Defined in: [packages/protocol/src/types.ts:111](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L111)
***
### senderPrefix [#senderprefix]
```ts
senderPrefix: string;
```
Defined in: [packages/protocol/src/types.ts:110](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L110)
***
### senderTimestamp [#sendertimestamp]
```ts
senderTimestamp: number;
```
Defined in: [packages/protocol/src/types.ts:114](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L114)
***
### signature [#signature]
```ts
signature: string | null;
```
Defined in: [packages/protocol/src/types.ts:115](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L115)
***
### snr [#snr]
```ts
snr: number | null;
```
Defined in: [packages/protocol/src/types.ts:109](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L109)
***
### text [#text]
```ts
text: string;
```
Defined in: [packages/protocol/src/types.ts:116](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L116)
***
### txtType [#txttype]
```ts
txtType: number;
```
Defined in: [packages/protocol/src/types.ts:113](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L113)
***
### type [#type]
```ts
type: "contactMessage";
```
Defined in: [packages/protocol/src/types.ts:107](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L107)
***
### version [#version]
```ts
version: 2 | 3;
```
Defined in: [packages/protocol/src/types.ts:108](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L108)
# ContactRecord (/docs/protocol/reference/interfaces/ContactRecord)
Defined in: [packages/protocol/src/types.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L4)
A contact as stored by the radio: key, kind (`ContactType`), flags, route, name, last advert, location, last modification.
## Properties [#properties]
### flags [#flags]
```ts
flags: number;
```
Defined in: [packages/protocol/src/types.ts:7](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L7)
***
### lastAdvertTimestamp [#lastadverttimestamp]
```ts
lastAdvertTimestamp: number;
```
Defined in: [packages/protocol/src/types.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L10)
***
### lastModified [#lastmodified]
```ts
lastModified: number;
```
Defined in: [packages/protocol/src/types.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L13)
***
### latitude [#latitude]
```ts
latitude: number;
```
Defined in: [packages/protocol/src/types.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L11)
***
### longitude [#longitude]
```ts
longitude: number;
```
Defined in: [packages/protocol/src/types.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L12)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/protocol/src/types.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L9)
***
### outPath [#outpath]
```ts
outPath: Path | null;
```
Defined in: [packages/protocol/src/types.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L8)
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/protocol/src/types.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L5)
***
### type [#type]
```ts
type: number;
```
Defined in: [packages/protocol/src/types.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L6)
# ContactsFullPush (/docs/protocol/reference/interfaces/ContactsFullPush)
Defined in: [packages/protocol/src/types.ts:188](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L188)
`ContactsFull` push: the contact table is full.
## Extends [#extends]
* `PushBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "push";
```
Defined in: [packages/protocol/src/types.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L57)
#### Inherited from [#inherited-from]
```ts
PushBase.kind
```
***
### type [#type]
```ts
type: "contactsFull";
```
Defined in: [packages/protocol/src/types.ts:189](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L189)
# ContactsStartFrame (/docs/protocol/reference/interfaces/ContactsStartFrame)
Defined in: [packages/protocol/src/types.ts:74](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L74)
`ContactsStart` response: a listing begins.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### total [#total]
```ts
total: number;
```
Defined in: [packages/protocol/src/types.ts:76](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L76)
***
### type [#type]
```ts
type: "contactsStart";
```
Defined in: [packages/protocol/src/types.ts:75](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L75)
# CurrentTimeFrame (/docs/protocol/reference/interfaces/CurrentTimeFrame)
Defined in: [packages/protocol/src/types.ts:131](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L131)
`CurrTime` response: the radio's clock.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### epochSeconds [#epochseconds]
```ts
epochSeconds: number;
```
Defined in: [packages/protocol/src/types.ts:133](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L133)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "currentTime";
```
Defined in: [packages/protocol/src/types.ts:132](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L132)
# DeviceInfo (/docs/protocol/reference/interfaces/DeviceInfo)
Defined in: [packages/protocol/src/types.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L33)
What `DEVICE_QUERY` returns: firmware version and, on newer firmwares, limits and build details (`null` when absent).
## Properties [#properties]
### blePin [#blepin]
```ts
blePin: number | null;
```
Defined in: [packages/protocol/src/types.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L37)
***
### firmwareBuildDate [#firmwarebuilddate]
```ts
firmwareBuildDate: string | null;
```
Defined in: [packages/protocol/src/types.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L38)
***
### firmwareVersion [#firmwareversion]
```ts
firmwareVersion: number;
```
Defined in: [packages/protocol/src/types.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L34)
***
### firmwareVersionName [#firmwareversionname]
```ts
firmwareVersionName: string | null;
```
Defined in: [packages/protocol/src/types.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L40)
***
### manufacturer [#manufacturer]
```ts
manufacturer: string | null;
```
Defined in: [packages/protocol/src/types.ts:39](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L39)
***
### maxChannels [#maxchannels]
```ts
maxChannels: number | null;
```
Defined in: [packages/protocol/src/types.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L36)
***
### maxContacts [#maxcontacts]
```ts
maxContacts: number | null;
```
Defined in: [packages/protocol/src/types.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L35)
***
### pathHashMode [#pathhashmode]
```ts
pathHashMode: number | null;
```
Defined in: [packages/protocol/src/types.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L42)
***
### repeatEnabled [#repeatenabled]
```ts
repeatEnabled: boolean | null;
```
Defined in: [packages/protocol/src/types.ts:41](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L41)
# DeviceInfoFrame (/docs/protocol/reference/interfaces/DeviceInfoFrame)
Defined in: [packages/protocol/src/types.ts:147](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L147)
`DeviceInfo` response to `DEVICE_QUERY`.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### deviceInfo [#deviceinfo]
```ts
deviceInfo: DeviceInfo;
```
Defined in: [packages/protocol/src/types.ts:149](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L149)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "deviceInfo";
```
Defined in: [packages/protocol/src/types.ts:148](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L148)
# DisabledFrame (/docs/protocol/reference/interfaces/DisabledFrame)
Defined in: [packages/protocol/src/types.ts:70](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L70)
`Disabled` response: the firmware refused the command because the feature is disabled.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "disabled";
```
Defined in: [packages/protocol/src/types.ts:71](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L71)
# EndOfContactsFrame (/docs/protocol/reference/interfaces/EndOfContactsFrame)
Defined in: [packages/protocol/src/types.ts:84](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L84)
`EndOfContacts` response: the listing is complete.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### mostRecentLastModified [#mostrecentlastmodified]
```ts
mostRecentLastModified: number;
```
Defined in: [packages/protocol/src/types.ts:86](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L86)
***
### type [#type]
```ts
type: "endOfContacts";
```
Defined in: [packages/protocol/src/types.ts:85](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L85)
# ErrFrame (/docs/protocol/reference/interfaces/ErrFrame)
Defined in: [packages/protocol/src/types.ts:65](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L65)
`Err` response, with a `RadioErrorCode`.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### errorCode [#errorcode]
```ts
errorCode: number | null;
```
Defined in: [packages/protocol/src/types.ts:67](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L67)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "err";
```
Defined in: [packages/protocol/src/types.ts:66](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L66)
# ExportContactFrame (/docs/protocol/reference/interfaces/ExportContactFrame)
Defined in: [packages/protocol/src/types.ts:89](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L89)
`ExportContact` response: an advert packet.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### packet [#packet]
```ts
packet: Uint8Array;
```
Defined in: [packages/protocol/src/types.ts:91](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L91)
***
### type [#type]
```ts
type: "exportContact";
```
Defined in: [packages/protocol/src/types.ts:90](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L90)
# MalformedFrame (/docs/protocol/reference/interfaces/MalformedFrame)
Defined in: [packages/protocol/src/types.ts:201](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L201)
A frame whose bytes do not fit the layout of its code; `reason` says what failed.
## Properties [#properties]
### bytes [#bytes]
```ts
bytes: Uint8Array;
```
Defined in: [packages/protocol/src/types.ts:205](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L205)
***
### code [#code]
```ts
code: number;
```
Defined in: [packages/protocol/src/types.ts:204](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L204)
***
### kind [#kind]
```ts
kind: "response" | "push";
```
Defined in: [packages/protocol/src/types.ts:202](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L202)
***
### reason [#reason]
```ts
reason: string;
```
Defined in: [packages/protocol/src/types.ts:206](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L206)
***
### type [#type]
```ts
type: "malformed";
```
Defined in: [packages/protocol/src/types.ts:203](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L203)
# MsgWaitingPush (/docs/protocol/reference/interfaces/MsgWaitingPush)
Defined in: [packages/protocol/src/types.ts:174](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L174)
`MsgWaiting` push: a message is ready to sync.
## Extends [#extends]
* `PushBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "push";
```
Defined in: [packages/protocol/src/types.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L57)
#### Inherited from [#inherited-from]
```ts
PushBase.kind
```
***
### type [#type]
```ts
type: "msgWaiting";
```
Defined in: [packages/protocol/src/types.ts:175](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L175)
# NewAdvertPush (/docs/protocol/reference/interfaces/NewAdvertPush)
Defined in: [packages/protocol/src/types.ts:178](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L178)
`NewAdvert` push: an unknown node advertised, with its would-be contact record.
## Extends [#extends]
* `PushBase`
## Properties [#properties]
### contact [#contact]
```ts
contact: ContactRecord;
```
Defined in: [packages/protocol/src/types.ts:180](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L180)
***
### kind [#kind]
```ts
kind: "push";
```
Defined in: [packages/protocol/src/types.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L57)
#### Inherited from [#inherited-from]
```ts
PushBase.kind
```
***
### type [#type]
```ts
type: "newAdvert";
```
Defined in: [packages/protocol/src/types.ts:179](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L179)
# NoMoreMessagesFrame (/docs/protocol/reference/interfaces/NoMoreMessagesFrame)
Defined in: [packages/protocol/src/types.ts:136](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L136)
`NoMoreMessages` response: nothing left to sync.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "noMoreMessages";
```
Defined in: [packages/protocol/src/types.ts:137](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L137)
# OkFrame (/docs/protocol/reference/interfaces/OkFrame)
Defined in: [packages/protocol/src/types.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L61)
`Ok` response.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### type [#type]
```ts
type: "ok";
```
Defined in: [packages/protocol/src/types.ts:62](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L62)
# Path (/docs/protocol/reference/interfaces/Path)
Defined in: [packages/protocol/src/path.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L4)
A route through the mesh: the hash size used and one hash per hop.
## Properties [#properties]
### hashSize [#hashsize]
```ts
hashSize: 1 | 2 | 3;
```
Defined in: [packages/protocol/src/path.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L5)
***
### hops [#hops]
```ts
hops: Uint8Array[];
```
Defined in: [packages/protocol/src/path.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L6)
# PathLength (/docs/protocol/reference/interfaces/PathLength)
Defined in: [packages/protocol/src/path.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L10)
The decoded `pathLen` byte of the wire format: hash size, hop count and total byte length.
## Properties [#properties]
### byteLength [#bytelength]
```ts
byteLength: number;
```
Defined in: [packages/protocol/src/path.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L13)
***
### hashSize [#hashsize]
```ts
hashSize: 1 | 2 | 3;
```
Defined in: [packages/protocol/src/path.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L11)
***
### hopCount [#hopcount]
```ts
hopCount: number;
```
Defined in: [packages/protocol/src/path.ts:12](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L12)
# PathUpdatedPush (/docs/protocol/reference/interfaces/PathUpdatedPush)
Defined in: [packages/protocol/src/types.ts:163](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L163)
`PathUpdated` push: the route to a contact changed.
## Extends [#extends]
* `PushBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "push";
```
Defined in: [packages/protocol/src/types.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L57)
#### Inherited from [#inherited-from]
```ts
PushBase.kind
```
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/protocol/src/types.ts:165](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L165)
***
### type [#type]
```ts
type: "pathUpdated";
```
Defined in: [packages/protocol/src/types.ts:164](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L164)
# SelfInfo (/docs/protocol/reference/interfaces/SelfInfo)
Defined in: [packages/protocol/src/types.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L17)
What the radio says about itself at `APP_START`: key, name, power, location, radio parameters and policies.
## Properties [#properties]
### advertLocationPolicy [#advertlocationpolicy]
```ts
advertLocationPolicy: number;
```
Defined in: [packages/protocol/src/types.ts:25](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L25)
***
### advertType [#adverttype]
```ts
advertType: number;
```
Defined in: [packages/protocol/src/types.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L18)
***
### latitude [#latitude]
```ts
latitude: number;
```
Defined in: [packages/protocol/src/types.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L22)
***
### longitude [#longitude]
```ts
longitude: number;
```
Defined in: [packages/protocol/src/types.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L23)
***
### manualAddContacts [#manualaddcontacts]
```ts
manualAddContacts: boolean;
```
Defined in: [packages/protocol/src/types.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L27)
***
### maxTxPowerDbm [#maxtxpowerdbm]
```ts
maxTxPowerDbm: number;
```
Defined in: [packages/protocol/src/types.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L20)
***
### multiAcks [#multiacks]
```ts
multiAcks: number;
```
Defined in: [packages/protocol/src/types.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L24)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/protocol/src/types.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L29)
***
### publicKey [#publickey]
```ts
publicKey: string;
```
Defined in: [packages/protocol/src/types.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L21)
***
### radio [#radio]
```ts
radio: object;
```
Defined in: [packages/protocol/src/types.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L28)
#### bandwidthHz [#bandwidthhz]
```ts
bandwidthHz: number;
```
#### codingRate [#codingrate]
```ts
codingRate: number;
```
#### frequencyKhz [#frequencykhz]
```ts
frequencyKhz: number;
```
#### spreadingFactor [#spreadingfactor]
```ts
spreadingFactor: number;
```
***
### telemetryModes [#telemetrymodes]
```ts
telemetryModes: object;
```
Defined in: [packages/protocol/src/types.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L26)
#### base [#base]
```ts
base: number;
```
#### environment [#environment]
```ts
environment: number;
```
#### location [#location]
```ts
location: number;
```
***
### txPowerDbm [#txpowerdbm]
```ts
txPowerDbm: number;
```
Defined in: [packages/protocol/src/types.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L19)
# SelfInfoFrame (/docs/protocol/reference/interfaces/SelfInfoFrame)
Defined in: [packages/protocol/src/types.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L94)
`SelfInfo` response to `APP_START`.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### selfInfo [#selfinfo]
```ts
selfInfo: SelfInfo;
```
Defined in: [packages/protocol/src/types.ts:96](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L96)
***
### type [#type]
```ts
type: "selfInfo";
```
Defined in: [packages/protocol/src/types.ts:95](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L95)
# SendChannelTxtMsgParams (/docs/protocol/reference/interfaces/SendChannelTxtMsgParams)
Defined in: [packages/protocol/src/commands.ts:60](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L60)
Parameters for [encodeSendChannelTxtMsg](../functions/encodeSendChannelTxtMsg.md).
## Properties [#properties]
### channelIndex [#channelindex]
```ts
channelIndex: number;
```
Defined in: [packages/protocol/src/commands.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L61)
***
### text [#text]
```ts
text: string;
```
Defined in: [packages/protocol/src/commands.ts:62](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L62)
***
### timestamp [#timestamp]
```ts
timestamp: number;
```
Defined in: [packages/protocol/src/commands.ts:63](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L63)
# SendConfirmedPush (/docs/protocol/reference/interfaces/SendConfirmedPush)
Defined in: [packages/protocol/src/types.ts:168](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L168)
`SendConfirmed` push: a direct message was acknowledged, with the round trip time.
## Extends [#extends]
* `PushBase`
## Properties [#properties]
### ack [#ack]
```ts
ack: number;
```
Defined in: [packages/protocol/src/types.ts:170](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L170)
***
### kind [#kind]
```ts
kind: "push";
```
Defined in: [packages/protocol/src/types.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L57)
#### Inherited from [#inherited-from]
```ts
PushBase.kind
```
***
### roundTripMs [#roundtripms]
```ts
roundTripMs: number;
```
Defined in: [packages/protocol/src/types.ts:171](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L171)
***
### type [#type]
```ts
type: "sendConfirmed";
```
Defined in: [packages/protocol/src/types.ts:169](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L169)
# SendTxtMsgParams (/docs/protocol/reference/interfaces/SendTxtMsgParams)
Defined in: [packages/protocol/src/commands.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L32)
Parameters for [encodeSendTxtMsg](../functions/encodeSendTxtMsg.md).
## Properties [#properties]
### attempt? [#attempt]
```ts
optional attempt?: number;
```
Defined in: [packages/protocol/src/commands.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L36)
***
### recipient [#recipient]
```ts
recipient: string;
```
Defined in: [packages/protocol/src/commands.ts:33](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L33)
***
### text [#text]
```ts
text: string;
```
Defined in: [packages/protocol/src/commands.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L34)
***
### timestamp [#timestamp]
```ts
timestamp: number;
```
Defined in: [packages/protocol/src/commands.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L35)
***
### txtType? [#txttype]
```ts
optional txtType?: number;
```
Defined in: [packages/protocol/src/commands.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L37)
# SentFrame (/docs/protocol/reference/interfaces/SentFrame)
Defined in: [packages/protocol/src/types.ts:99](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L99)
`Sent` response to a text message: flood or direct, the ack to expect and the suggested timeout.
## Extends [#extends]
* `ResponseBase`
## Properties [#properties]
### expectedAck [#expectedack]
```ts
expectedAck: number;
```
Defined in: [packages/protocol/src/types.ts:102](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L102)
***
### flood [#flood]
```ts
flood: boolean;
```
Defined in: [packages/protocol/src/types.ts:101](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L101)
***
### kind [#kind]
```ts
kind: "response";
```
Defined in: [packages/protocol/src/types.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L53)
#### Inherited from [#inherited-from]
```ts
ResponseBase.kind
```
***
### suggestedTimeoutMs [#suggestedtimeoutms]
```ts
suggestedTimeoutMs: number;
```
Defined in: [packages/protocol/src/types.ts:103](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L103)
***
### type [#type]
```ts
type: "sent";
```
Defined in: [packages/protocol/src/types.ts:100](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L100)
# SetAdvertLatLonCommand (/docs/protocol/reference/interfaces/SetAdvertLatLonCommand)
Defined in: [packages/protocol/src/commands.ts:216](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L216)
Parameters for [encodeSetAdvertLatLon](../functions/encodeSetAdvertLatLon.md): latitude and longitude in decimal degrees.
## Properties [#properties]
### latitude [#latitude]
```ts
latitude: number;
```
Defined in: [packages/protocol/src/commands.ts:217](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L217)
***
### longitude [#longitude]
```ts
longitude: number;
```
Defined in: [packages/protocol/src/commands.ts:218](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L218)
# SetChannelParams (/docs/protocol/reference/interfaces/SetChannelParams)
Defined in: [packages/protocol/src/commands.ts:180](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L180)
Parameters for [encodeSetChannel](../functions/encodeSetChannel.md).
## Properties [#properties]
### index [#index]
```ts
index: number;
```
Defined in: [packages/protocol/src/commands.ts:181](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L181)
***
### name [#name]
```ts
name: string;
```
Defined in: [packages/protocol/src/commands.ts:182](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L182)
***
### secret [#secret]
```ts
secret: Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:183](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L183)
# SetRadioParamsCommand (/docs/protocol/reference/interfaces/SetRadioParamsCommand)
Defined in: [packages/protocol/src/commands.ts:245](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L245)
Parameters for [encodeSetRadioParams](../functions/encodeSetRadioParams.md); `repeat` is written to the wire only when defined.
## Properties [#properties]
### bandwidthHz [#bandwidthhz]
```ts
bandwidthHz: number;
```
Defined in: [packages/protocol/src/commands.ts:247](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L247)
***
### codingRate [#codingrate]
```ts
codingRate: number;
```
Defined in: [packages/protocol/src/commands.ts:249](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L249)
***
### frequencyKhz [#frequencykhz]
```ts
frequencyKhz: number;
```
Defined in: [packages/protocol/src/commands.ts:246](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L246)
***
### repeat? [#repeat]
```ts
optional repeat?: boolean;
```
Defined in: [packages/protocol/src/commands.ts:250](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L250)
***
### spreadingFactor [#spreadingfactor]
```ts
spreadingFactor: number;
```
Defined in: [packages/protocol/src/commands.ts:248](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L248)
# UnknownFrame (/docs/protocol/reference/interfaces/UnknownFrame)
Defined in: [packages/protocol/src/types.ts:193](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L193)
A frame whose code this codec does not know; the raw bytes are kept.
## Properties [#properties]
### bytes [#bytes]
```ts
bytes: Uint8Array;
```
Defined in: [packages/protocol/src/types.ts:197](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L197)
***
### code [#code]
```ts
code: number;
```
Defined in: [packages/protocol/src/types.ts:196](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L196)
***
### kind [#kind]
```ts
kind: "response" | "push";
```
Defined in: [packages/protocol/src/types.ts:194](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L194)
***
### type [#type]
```ts
type: "unknown";
```
Defined in: [packages/protocol/src/types.ts:195](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L195)
# contactUri() (/docs/protocol/reference/functions/contactUri)
```ts
function contactUri(packet): string;
```
Defined in: [packages/protocol/src/contact-uri.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/contact-uri.ts#L10)
The `meshcore://` link of a node, from its advert packet (what `EXPORT_CONTACT` returns).
## Parameters [#parameters]
### packet [#packet]
`Uint8Array`
Advert packet of the node
## Returns [#returns]
`string`
# decodeFrame() (/docs/protocol/reference/functions/decodeFrame)
```ts
function decodeFrame(bytes): DecodedFrame;
```
Defined in: [packages/protocol/src/decode/decode-frame.ts:116](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/decode/decode-frame.ts#L116)
Decode one radio → app payload into a typed frame: a response, a push, `unknown` for a code this codec does not know, `malformed` when the bytes do not fit the layout.
## Parameters [#parameters]
### bytes [#bytes]
`Uint8Array`
Frame payload without framing
## Returns [#returns]
[`DecodedFrame`](../type-aliases/DecodedFrame.md)
# decodePath() (/docs/protocol/reference/functions/decodePath)
```ts
function decodePath(pathLen, raw): Path | null;
```
Defined in: [packages/protocol/src/path.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L35)
Decode a route from its `pathLen` byte and raw hop bytes; `null` when unknown.
## Parameters [#parameters]
### pathLen [#pathlen]
`number`
Wire path length byte
### raw [#raw]
`Uint8Array`
Path bytes
## Returns [#returns]
[`Path`](../interfaces/Path.md) | `null`
# decodePathLength() (/docs/protocol/reference/functions/decodePathLength)
```ts
function decodePathLength(pathLen): PathLength | null;
```
Defined in: [packages/protocol/src/path.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L20)
Split a wire `pathLen` byte into hash size and hop count; `null` when the route is unknown.
## Parameters [#parameters]
### pathLen [#pathlen]
`number`
Wire path length byte
## Returns [#returns]
[`PathLength`](../interfaces/PathLength.md) | `null`
# encodeAddUpdateContact() (/docs/protocol/reference/functions/encodeAddUpdateContact)
```ts
function encodeAddUpdateContact(contact): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:122](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L122)
`ADD_UPDATE_CONTACT`: create or overwrite a contact of the radio's table.
## Parameters [#parameters]
### contact [#contact]
[`ContactRecord`](../interfaces/ContactRecord.md)
Contact record
## Returns [#returns]
`Uint8Array`
# encodeAdvertPush() (/docs/protocol/reference/functions/encodeAdvertPush)
```ts
function encodeAdvertPush(publicKey): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:175](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L175)
Encode the `Advert` push: a known contact advertised again.
## Parameters [#parameters]
### publicKey [#publickey]
`string`
## Returns [#returns]
`Uint8Array`
# encodeAppStart() (/docs/protocol/reference/functions/encodeAppStart)
```ts
function encodeAppStart(appName): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L18)
`APP_START`: identify the app to the radio; the radio answers with `SelfInfo`.
## Parameters [#parameters]
### appName [#appname]
`string`
Name announced to the radio
## Returns [#returns]
`Uint8Array`
# encodeBattAndStorageResponse() (/docs/protocol/reference/functions/encodeBattAndStorageResponse)
```ts
function encodeBattAndStorageResponse(params): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:151](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L151)
Encode `BattAndStorage`: battery millivolts and storage usage.
## Parameters [#parameters]
### params [#params]
#### batteryMillivolts [#batterymillivolts]
`number`
#### storageTotalKb [#storagetotalkb]
`number` | `null`
#### storageUsedKb [#storageusedkb]
`number` | `null`
## Returns [#returns]
`Uint8Array`
# encodeChannelInfoResponse() (/docs/protocol/reference/functions/encodeChannelInfoResponse)
```ts
function encodeChannelInfoResponse(channel): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:170](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L170)
Encode `ChannelInfo`, the answer to `GET_CHANNEL`.
## Parameters [#parameters]
### channel [#channel]
[`ChannelRecord`](../interfaces/ChannelRecord.md)
## Returns [#returns]
`Uint8Array`
# encodeChannelMessageResponse() (/docs/protocol/reference/functions/encodeChannelMessageResponse)
```ts
function encodeChannelMessageResponse(message): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:116](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L116)
Encode a received channel message (`ChannelMsgRecv`, version 2 or 3).
## Parameters [#parameters]
### message [#message]
[`ChannelMessageParams`](../type-aliases/ChannelMessageParams.md)
## Returns [#returns]
`Uint8Array`
# encodeContactDeletedPush() (/docs/protocol/reference/functions/encodeContactDeletedPush)
```ts
function encodeContactDeletedPush(publicKey): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:202](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L202)
Encode the `ContactDeleted` push.
## Parameters [#parameters]
### publicKey [#publickey]
`string`
## Returns [#returns]
`Uint8Array`
# encodeContactMessageResponse() (/docs/protocol/reference/functions/encodeContactMessageResponse)
```ts
function encodeContactMessageResponse(message): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:83](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L83)
Encode a received direct message (`ContactMsgRecv`, version 2 or 3).
## Parameters [#parameters]
### message [#message]
[`ContactMessageParams`](../type-aliases/ContactMessageParams.md)
## Returns [#returns]
`Uint8Array`
# encodeContactResponse() (/docs/protocol/reference/functions/encodeContactResponse)
```ts
function encodeContactResponse(contact): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:40](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L40)
Encode one `Contact` of a listing.
## Parameters [#parameters]
### contact [#contact]
[`ContactRecord`](../interfaces/ContactRecord.md)
## Returns [#returns]
`Uint8Array`
# encodeContactsFullPush() (/docs/protocol/reference/functions/encodeContactsFullPush)
```ts
function encodeContactsFullPush(): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:207](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L207)
Encode the `ContactsFull` push: the contact table cannot take another entry.
## Returns [#returns]
`Uint8Array`
# encodeContactsStartResponse() (/docs/protocol/reference/functions/encodeContactsStartResponse)
```ts
function encodeContactsStartResponse(total): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:34](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L34)
Encode `ContactsStart`, opening a contact listing with the number of contacts to follow.
## Parameters [#parameters]
### total [#total]
`number`
## Returns [#returns]
`Uint8Array`
# encodeCurrentTimeResponse() (/docs/protocol/reference/functions/encodeCurrentTimeResponse)
```ts
function encodeCurrentTimeResponse(epochSeconds): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:140](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L140)
Encode `CurrTime` with the radio's clock.
## Parameters [#parameters]
### epochSeconds [#epochseconds]
`number`
## Returns [#returns]
`Uint8Array`
# encodeDeviceInfoResponse() (/docs/protocol/reference/functions/encodeDeviceInfoResponse)
```ts
function encodeDeviceInfoResponse(info): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:165](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L165)
Encode `DeviceInfo`, the answer to `DEVICE_QUERY`.
## Parameters [#parameters]
### info [#info]
[`DeviceInfo`](../interfaces/DeviceInfo.md)
## Returns [#returns]
`Uint8Array`
# encodeDeviceQuery() (/docs/protocol/reference/functions/encodeDeviceQuery)
```ts
function encodeDeviceQuery(appTargetVersion?): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L26)
`DEVICE_QUERY`: ask the radio for its `DeviceInfo`, announcing the protocol version the app supports.
## Parameters [#parameters]
### appTargetVersion? [#apptargetversion]
`number` = `APP_TARGET_VERSION`
Protocol version the app supports. Default 3
## Returns [#returns]
`Uint8Array`
# encodeEndOfContactsResponse() (/docs/protocol/reference/functions/encodeEndOfContactsResponse)
```ts
function encodeEndOfContactsResponse(mostRecentLastModified): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L45)
Encode `EndOfContacts`, closing a listing with the newest `lastModified`.
## Parameters [#parameters]
### mostRecentLastModified [#mostrecentlastmodified]
`number`
## Returns [#returns]
`Uint8Array`
# encodeErrResponse() (/docs/protocol/reference/functions/encodeErrResponse)
```ts
function encodeErrResponse(errorCode): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L28)
Encode an `Err` response with a `RadioErrorCode`.
## Parameters [#parameters]
### errorCode [#errorcode]
`number`
## Returns [#returns]
`Uint8Array`
# encodeExportContact() (/docs/protocol/reference/functions/encodeExportContact)
```ts
function encodeExportContact(publicKey?): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:151](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L151)
`EXPORT_CONTACT`: get the advert packet of a contact, or of this node when no key is given; answered by `ExportContact`.
## Parameters [#parameters]
### publicKey? [#publickey]
`string`
Contact to export, this node when omitted
## Returns [#returns]
`Uint8Array`
# encodeExportContactResponse() (/docs/protocol/reference/functions/encodeExportContactResponse)
```ts
function encodeExportContactResponse(packet): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:51](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L51)
Encode `ExportContact` with an advert packet.
## Parameters [#parameters]
### packet [#packet]
`Uint8Array`
## Returns [#returns]
`Uint8Array`
# encodeFrame() (/docs/protocol/reference/functions/encodeFrame)
```ts
function encodeFrame(payload, direction?): Uint8Array;
```
Defined in: [packages/protocol/src/framing.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L20)
Wrap a payload in the serial/TCP framing: marker, length (u16 little-endian), payload.
## Parameters [#parameters]
### payload [#payload]
`Uint8Array`
Frame payload
### direction? [#direction]
[`FrameDirection`](../type-aliases/FrameDirection.md) = `'toRadio'`
toRadio or fromRadio. Default toRadio
## Returns [#returns]
`Uint8Array`
# encodeGetBattAndStorage() (/docs/protocol/reference/functions/encodeGetBattAndStorage)
```ts
function encodeGetBattAndStorage(): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:158](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L158)
`GET_BATT_AND_STORAGE`: read the battery voltage and storage usage; answered by `BattAndStorage`.
## Returns [#returns]
`Uint8Array`
# encodeGetChannel() (/docs/protocol/reference/functions/encodeGetChannel)
```ts
function encodeGetChannel(index): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:174](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L174)
`GET_CHANNEL`: read a channel slot; answered by `ChannelInfo`.
## Parameters [#parameters]
### index [#index]
`number`
Channel slot
## Returns [#returns]
`Uint8Array`
# encodeGetContactByKey() (/docs/protocol/reference/functions/encodeGetContactByKey)
```ts
function encodeGetContactByKey(publicKey): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:166](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L166)
`GET_CONTACT_BY_KEY`: read one contact; answered by `Contact` or `Err`.
## Parameters [#parameters]
### publicKey [#publickey]
`string`
64 hex characters
## Returns [#returns]
`Uint8Array`
# encodeGetContacts() (/docs/protocol/reference/functions/encodeGetContacts)
```ts
function encodeGetContacts(since?): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:87](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L87)
`GET_CONTACTS`: list the contact table, optionally only those modified since a timestamp; answered by `ContactsStart`, `Contact`… `EndOfContacts`.
## Parameters [#parameters]
### since? [#since]
`number`
Only contacts modified after this epoch
## Returns [#returns]
`Uint8Array`
# encodeGetDeviceTime() (/docs/protocol/reference/functions/encodeGetDeviceTime)
```ts
function encodeGetDeviceTime(): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:97](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L97)
`GET_DEVICE_TIME`: read the radio's clock; answered by `CurrTime`.
## Returns [#returns]
`Uint8Array`
# encodeMsgWaitingPush() (/docs/protocol/reference/functions/encodeMsgWaitingPush)
```ts
function encodeMsgWaitingPush(): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:192](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L192)
Encode the `MsgWaiting` push: a message is ready for `SYNC_NEXT_MESSAGE`.
## Returns [#returns]
`Uint8Array`
# encodeNewAdvertPush() (/docs/protocol/reference/functions/encodeNewAdvertPush)
```ts
function encodeNewAdvertPush(contact): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:197](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L197)
Encode the `NewAdvert` push: an unknown node advertised (manual-add mode).
## Parameters [#parameters]
### contact [#contact]
[`ContactRecord`](../interfaces/ContactRecord.md)
## Returns [#returns]
`Uint8Array`
# encodeNoMoreMessagesResponse() (/docs/protocol/reference/functions/encodeNoMoreMessagesResponse)
```ts
function encodeNoMoreMessagesResponse(): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:146](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L146)
Encode `NoMoreMessages`, the answer to `SYNC_NEXT_MESSAGE` when the queue is empty.
## Returns [#returns]
`Uint8Array`
# encodeOkResponse() (/docs/protocol/reference/functions/encodeOkResponse)
```ts
function encodeOkResponse(): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L23)
Encode an `Ok` response (what a fake radio answers to most commands).
## Returns [#returns]
`Uint8Array`
# encodePath() (/docs/protocol/reference/functions/encodePath)
```ts
function encodePath(path): object;
```
Defined in: [packages/protocol/src/path.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/path.ts#L49)
Encode a route into its `pathLen` byte and hop bytes; `null` encodes as unknown.
## Parameters [#parameters]
### path [#path]
[`Path`](../interfaces/Path.md) | `null`
Path bytes, or null for flood
## Returns [#returns]
`object`
### bytes [#bytes]
```ts
bytes: Uint8Array;
```
### pathLen [#pathlen]
```ts
pathLen: number;
```
# encodePathUpdatedPush() (/docs/protocol/reference/functions/encodePathUpdatedPush)
```ts
function encodePathUpdatedPush(publicKey): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:180](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L180)
Encode the `PathUpdated` push: the route to a contact changed.
## Parameters [#parameters]
### publicKey [#publickey]
`string`
## Returns [#returns]
`Uint8Array`
# encodeRemoveContact() (/docs/protocol/reference/functions/encodeRemoveContact)
```ts
function encodeRemoveContact(publicKey): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:143](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L143)
`REMOVE_CONTACT`: delete a contact from the radio's table.
## Parameters [#parameters]
### publicKey [#publickey]
`string`
64 hex characters
## Returns [#returns]
`Uint8Array`
# encodeResetPath() (/docs/protocol/reference/functions/encodeResetPath)
```ts
function encodeResetPath(publicKey): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:135](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L135)
`RESET_PATH`: forget the route to a contact so the next message floods.
## Parameters [#parameters]
### publicKey [#publickey]
`string`
64 hex characters
## Returns [#returns]
`Uint8Array`
# encodeSelfInfoResponse() (/docs/protocol/reference/functions/encodeSelfInfoResponse)
```ts
function encodeSelfInfoResponse(info): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L56)
Encode `SelfInfo`, the answer to `APP_START`.
## Parameters [#parameters]
### info [#info]
[`SelfInfo`](../interfaces/SelfInfo.md)
## Returns [#returns]
`Uint8Array`
# encodeSendChannelTxtMsg() (/docs/protocol/reference/functions/encodeSendChannelTxtMsg)
```ts
function encodeSendChannelTxtMsg(params): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:70](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L70)
`SEND_CHANNEL_TXT_MSG`: post a message on a channel; the radio answers `Ok`.
## Parameters [#parameters]
### params [#params]
[`SendChannelTxtMsgParams`](../interfaces/SendChannelTxtMsgParams.md)
channelIndex, text and timestamp
## Returns [#returns]
`Uint8Array`
# encodeSendConfirmedPush() (/docs/protocol/reference/functions/encodeSendConfirmedPush)
```ts
function encodeSendConfirmedPush(params): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:185](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L185)
Encode the `SendConfirmed` push: a direct message was acknowledged.
## Parameters [#parameters]
### params [#params]
#### ack [#ack]
`number`
#### roundTripMs [#roundtripms]
`number`
## Returns [#returns]
`Uint8Array`
# encodeSendSelfAdvert() (/docs/protocol/reference/functions/encodeSendSelfAdvert)
```ts
function encodeSendSelfAdvert(options): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:114](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L114)
`SEND_SELF_ADVERT`: advertise this node to the mesh, direct or flood.
## Parameters [#parameters]
### options [#options]
flood or zero-hop
#### flood [#flood]
`boolean`
## Returns [#returns]
`Uint8Array`
# encodeSendTxtMsg() (/docs/protocol/reference/functions/encodeSendTxtMsg)
```ts
function encodeSendTxtMsg(params): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L44)
`SEND_TXT_MSG`: send a direct message to a contact; the radio answers `Sent` with the ack to wait for.
## Parameters [#parameters]
### params [#params]
[`SendTxtMsgParams`](../interfaces/SendTxtMsgParams.md)
recipient, text, timestamp, attempt and txtType
## Returns [#returns]
`Uint8Array`
# encodeSentResponse() (/docs/protocol/reference/functions/encodeSentResponse)
```ts
function encodeSentResponse(params): Uint8Array;
```
Defined in: [packages/protocol/src/responses.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L61)
Encode `Sent`, the answer to a text message: flood or direct, expected ack and suggested timeout.
## Parameters [#parameters]
### params [#params]
#### expectedAck [#expectedack]
`number`
#### flood [#flood]
`boolean`
#### suggestedTimeoutMs [#suggestedtimeoutms]
`number`
## Returns [#returns]
`Uint8Array`
# encodeSetAdvertLatLon() (/docs/protocol/reference/functions/encodeSetAdvertLatLon)
```ts
function encodeSetAdvertLatLon(params): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:225](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L225)
`SET_ADVERT_LATLON`: set the location this node advertises.
## Parameters [#parameters]
### params [#params]
[`SetAdvertLatLonCommand`](../interfaces/SetAdvertLatLonCommand.md)
latitude and longitude in decimal degrees
## Returns [#returns]
`Uint8Array`
# encodeSetAdvertName() (/docs/protocol/reference/functions/encodeSetAdvertName)
```ts
function encodeSetAdvertName(name): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:207](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L207)
`SET_ADVERT_NAME`: rename this node (at most 31 UTF-8 bytes).
## Parameters [#parameters]
### name [#name]
`string`
1 to 31 UTF-8 bytes
## Returns [#returns]
`Uint8Array`
# encodeSetChannel() (/docs/protocol/reference/functions/encodeSetChannel)
```ts
function encodeSetChannel(params): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:190](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L190)
`SET_CHANNEL`: write a channel slot (name and 16-byte secret).
## Parameters [#parameters]
### params [#params]
[`SetChannelParams`](../interfaces/SetChannelParams.md)
Slot, name and secret
## Returns [#returns]
`Uint8Array`
# encodeSetDeviceTime() (/docs/protocol/reference/functions/encodeSetDeviceTime)
```ts
function encodeSetDeviceTime(epochSeconds): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:105](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L105)
`SET_DEVICE_TIME`: set the radio's clock, in seconds since the Unix epoch.
## Parameters [#parameters]
### epochSeconds [#epochseconds]
`number`
Current time in seconds
## Returns [#returns]
`Uint8Array`
# encodeSetRadioParams() (/docs/protocol/reference/functions/encodeSetRadioParams)
```ts
function encodeSetRadioParams(params): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:257](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L257)
`SET_RADIO_PARAMS`: set frequency, bandwidth, spreading factor and coding rate.
## Parameters [#parameters]
### params [#params]
[`SetRadioParamsCommand`](../interfaces/SetRadioParamsCommand.md)
frequencyKhz, bandwidthHz, spreadingFactor, codingRate and optional repeat
## Returns [#returns]
`Uint8Array`
# encodeSetRadioTxPower() (/docs/protocol/reference/functions/encodeSetRadioTxPower)
```ts
function encodeSetRadioTxPower(dbm): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:239](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L239)
`SET_RADIO_TX_POWER`: set the transmit power in dBm.
## Parameters [#parameters]
### dbm [#dbm]
`number`
Transmit power
## Returns [#returns]
`Uint8Array`
# encodeSyncNextMessage() (/docs/protocol/reference/functions/encodeSyncNextMessage)
```ts
function encodeSyncNextMessage(): Uint8Array;
```
Defined in: [packages/protocol/src/commands.ts:127](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/commands.ts#L127)
`SYNC_NEXT_MESSAGE`: pop the next received message; answered by `ContactMsgRecv`, `ChannelMsgRecv` or `NoMoreMessages`.
## Returns [#returns]
`Uint8Array`
# fromHex() (/docs/protocol/reference/functions/fromHex)
```ts
function fromHex(hex): Uint8Array;
```
Defined in: [packages/protocol/src/bytes.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L26)
Bytes of a hex string (case-insensitive); throws on an odd length or a non-hex character.
## Parameters [#parameters]
### hex [#hex]
`string`
Hex string, spaces allowed
## Returns [#returns]
`Uint8Array`
# isPublicKeyHex() (/docs/protocol/reference/functions/isPublicKeyHex)
```ts
function isPublicKeyHex(value): boolean;
```
Defined in: [packages/protocol/src/keys.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/keys.ts#L10)
Whether `value` is a full public key: 64 lowercase hex characters.
## Parameters [#parameters]
### value [#value]
`string`
Candidate 64 hex characters
## Returns [#returns]
`boolean`
# parseContactUri() (/docs/protocol/reference/functions/parseContactUri)
```ts
function parseContactUri(uri): Uint8Array;
```
Defined in: [packages/protocol/src/contact-uri.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/contact-uri.ts#L18)
The advert packet inside a `meshcore://` link; throws when the link is not one.
## Parameters [#parameters]
### uri [#uri]
`string`
meshcore:// contact link
## Returns [#returns]
`Uint8Array`
# publicKeyPrefixToBytes() (/docs/protocol/reference/functions/publicKeyPrefixToBytes)
```ts
function publicKeyPrefixToBytes(keyOrPrefix): Uint8Array;
```
Defined in: [packages/protocol/src/keys.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/keys.ts#L30)
The first 6 bytes of a public key or key prefix, as received messages identify senders.
## Parameters [#parameters]
### keyOrPrefix [#keyorprefix]
`string`
At least 12 hex characters
## Returns [#returns]
`Uint8Array`
# publicKeyToBytes() (/docs/protocol/reference/functions/publicKeyToBytes)
```ts
function publicKeyToBytes(publicKey): Uint8Array;
```
Defined in: [packages/protocol/src/keys.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/keys.ts#L18)
The 32 bytes of a full public key.
## Parameters [#parameters]
### publicKey [#publickey]
`string`
64 hex characters
## Returns [#returns]
`Uint8Array`
# toHex() (/docs/protocol/reference/functions/toHex)
```ts
function toHex(bytes): string;
```
Defined in: [packages/protocol/src/bytes.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L16)
Lowercase hex string of `bytes`.
## Parameters [#parameters]
### bytes [#bytes]
`Uint8Array`
Bytes to print
## Returns [#returns]
`string`
# utf8ByteLength() (/docs/protocol/reference/functions/utf8ByteLength)
```ts
function utf8ByteLength(text): number;
```
Defined in: [packages/protocol/src/bytes.ts:8](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/bytes.ts#L8)
The number of bytes `text` takes in UTF-8, what the 160-byte limit counts.
## Parameters [#parameters]
### text [#text]
`string`
Text to measure
## Returns [#returns]
`number`
# ChannelMessageParams (/docs/protocol/reference/type-aliases/ChannelMessageParams)
```ts
type ChannelMessageParams = Omit;
```
Defined in: [packages/protocol/src/responses.ts:113](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L113)
Parameters accepted by [encodeChannelMessageResponse](../functions/encodeChannelMessageResponse.md): a [ChannelMessageFrame](../interfaces/ChannelMessageFrame.md) without its
derived fields.
# ContactMessageParams (/docs/protocol/reference/type-aliases/ContactMessageParams)
```ts
type ContactMessageParams = Omit;
```
Defined in: [packages/protocol/src/responses.ts:80](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/responses.ts#L80)
Parameters accepted by [encodeContactMessageResponse](../functions/encodeContactMessageResponse.md): a [ContactMessageFrame](../interfaces/ContactMessageFrame.md) without its
derived fields.
# DecodedFrame (/docs/protocol/reference/type-aliases/DecodedFrame)
```ts
type DecodedFrame =
| ResponseFrame
| PushFrame
| UnknownFrame
| MalformedFrame;
```
Defined in: [packages/protocol/src/types.ts:239](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L239)
What `decodeFrame()` returns: a response, a push, or an `unknown` / `malformed` frame.
# FrameDirection (/docs/protocol/reference/type-aliases/FrameDirection)
```ts
type FrameDirection = "toRadio" | "fromRadio";
```
Defined in: [packages/protocol/src/framing.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L9)
Which side sends the frame; selects the marker byte.
# PushFrame (/docs/protocol/reference/type-aliases/PushFrame)
```ts
type PushFrame =
| AdvertPush
| PathUpdatedPush
| SendConfirmedPush
| MsgWaitingPush
| NewAdvertPush
| ContactDeletedPush
| ContactsFullPush;
```
Defined in: [packages/protocol/src/types.ts:229](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L229)
Every decoded push, discriminated by `type`.
# ResponseFrame (/docs/protocol/reference/type-aliases/ResponseFrame)
```ts
type ResponseFrame =
| OkFrame
| ErrFrame
| DisabledFrame
| ContactsStartFrame
| ContactFrame
| EndOfContactsFrame
| ExportContactFrame
| SelfInfoFrame
| SentFrame
| ContactMessageFrame
| ChannelMessageFrame
| CurrentTimeFrame
| NoMoreMessagesFrame
| BattAndStorageFrame
| DeviceInfoFrame
| ChannelInfoFrame;
```
Defined in: [packages/protocol/src/types.ts:210](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/types.ts#L210)
Every decoded response, discriminated by `type`.
# APP_TARGET_VERSION (/docs/protocol/reference/variables/APP_TARGET_VERSION)
```ts
const APP_TARGET_VERSION: 3 = 3;
```
Defined in: [packages/protocol/src/constants.ts:109](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L109)
The Companion protocol version this codec speaks.
# CHANNEL_SECRET_SIZE (/docs/protocol/reference/variables/CHANNEL_SECRET_SIZE)
```ts
const CHANNEL_SECRET_SIZE: 16 = 16;
```
Defined in: [packages/protocol/src/constants.ts:98](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L98)
A channel secret, in bytes.
# CONTACT_URI_PREFIX (/docs/protocol/reference/variables/CONTACT_URI_PREFIX)
```ts
const CONTACT_URI_PREFIX: "meshcore://" = 'meshcore://';
```
Defined in: [packages/protocol/src/contact-uri.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/contact-uri.ts#L4)
The scheme of a MeshCore contact link.
# CommandCode (/docs/protocol/reference/variables/CommandCode)
```ts
const CommandCode: object;
```
Defined in: [packages/protocol/src/constants.ts:2](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L2)
First byte of every app → radio command.
## Type Declaration [#type-declaration]
### AddUpdateContact [#addupdatecontact]
```ts
readonly AddUpdateContact: 9 = 9;
```
### AppStart [#appstart]
```ts
readonly AppStart: 1 = 1;
```
### DeviceQuery [#devicequery]
```ts
readonly DeviceQuery: 22 = 22;
```
### ExportContact [#exportcontact]
```ts
readonly ExportContact: 17 = 17;
```
### GetBattAndStorage [#getbattandstorage]
```ts
readonly GetBattAndStorage: 20 = 20;
```
### GetChannel [#getchannel]
```ts
readonly GetChannel: 31 = 31;
```
### GetContactByKey [#getcontactbykey]
```ts
readonly GetContactByKey: 30 = 30;
```
### GetContacts [#getcontacts]
```ts
readonly GetContacts: 4 = 4;
```
### GetDeviceTime [#getdevicetime]
```ts
readonly GetDeviceTime: 5 = 5;
```
### RemoveContact [#removecontact]
```ts
readonly RemoveContact: 15 = 15;
```
### ResetPath [#resetpath]
```ts
readonly ResetPath: 13 = 13;
```
### SendChannelTxtMsg [#sendchanneltxtmsg]
```ts
readonly SendChannelTxtMsg: 3 = 3;
```
### SendSelfAdvert [#sendselfadvert]
```ts
readonly SendSelfAdvert: 7 = 7;
```
### SendTxtMsg [#sendtxtmsg]
```ts
readonly SendTxtMsg: 2 = 2;
```
### SetAdvertLatLon [#setadvertlatlon]
```ts
readonly SetAdvertLatLon: 14 = 14;
```
### SetAdvertName [#setadvertname]
```ts
readonly SetAdvertName: 8 = 8;
```
### SetChannel [#setchannel]
```ts
readonly SetChannel: 32 = 32;
```
### SetDeviceTime [#setdevicetime]
```ts
readonly SetDeviceTime: 6 = 6;
```
### SetRadioParams [#setradioparams]
```ts
readonly SetRadioParams: 11 = 11;
```
### SetRadioTxPower [#setradiotxpower]
```ts
readonly SetRadioTxPower: 12 = 12;
```
### SyncNextMessage [#syncnextmessage]
```ts
readonly SyncNextMessage: 10 = 10;
```
# ContactType (/docs/protocol/reference/variables/ContactType)
```ts
const ContactType: object;
```
Defined in: [packages/protocol/src/constants.ts:70](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L70)
Contact kind stored in [ContactRecord](../interfaces/ContactRecord.md)'s `type` field: none, chat, repeater, room or sensor.
## Type Declaration [#type-declaration]
### Chat [#chat]
```ts
readonly Chat: 1 = 1;
```
### None [#none]
```ts
readonly None: 0 = 0;
```
### Repeater [#repeater]
```ts
readonly Repeater: 2 = 2;
```
### Room [#room]
```ts
readonly Room: 3 = 3;
```
### Sensor [#sensor]
```ts
readonly Sensor: 4 = 4;
```
# FROM_RADIO_MARKER (/docs/protocol/reference/variables/FROM_RADIO_MARKER)
```ts
const FROM_RADIO_MARKER: 62 = 0x3e;
```
Defined in: [packages/protocol/src/framing.ts:6](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L6)
The `'>'` byte opening a radio → app serial/TCP frame.
# MAX_FRAME_SIZE (/docs/protocol/reference/variables/MAX_FRAME_SIZE)
```ts
const MAX_FRAME_SIZE: 176 = 176;
```
Defined in: [packages/protocol/src/constants.ts:86](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L86)
Largest frame payload the firmware accepts, in bytes.
# MAX_PATH_SIZE (/docs/protocol/reference/variables/MAX_PATH_SIZE)
```ts
const MAX_PATH_SIZE: 64 = 64;
```
Defined in: [packages/protocol/src/constants.ts:92](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L92)
Largest route (`Path`) the firmware stores, in bytes.
# MAX_TEXT_LEN (/docs/protocol/reference/variables/MAX_TEXT_LEN)
```ts
const MAX_TEXT_LEN: 160 = 160;
```
Defined in: [packages/protocol/src/constants.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L94)
Longest text in a message, in UTF-8 bytes.
# MIN_FIRMWARE_VERSION (/docs/protocol/reference/variables/MIN_FIRMWARE_VERSION)
```ts
const MIN_FIRMWARE_VERSION: 3 = 3;
```
Defined in: [packages/protocol/src/constants.ts:111](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L111)
Oldest firmware protocol version the client accepts at login.
# NAME_FIELD_SIZE (/docs/protocol/reference/variables/NAME_FIELD_SIZE)
```ts
const NAME_FIELD_SIZE: 32 = 32;
```
Defined in: [packages/protocol/src/constants.ts:96](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L96)
The fixed-size name field of contacts and self info, in bytes (NUL-padded).
# OUT_PATH_UNKNOWN (/docs/protocol/reference/variables/OUT_PATH_UNKNOWN)
```ts
const OUT_PATH_UNKNOWN: 255 = 0xff;
```
Defined in: [packages/protocol/src/constants.ts:107](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L107)
The `pathLen` meaning the route to a contact is unknown.
# PUBLIC_CHANNEL_SECRET (/docs/protocol/reference/variables/PUBLIC_CHANNEL_SECRET)
```ts
const PUBLIC_CHANNEL_SECRET: Uint8Array;
```
Defined in: [packages/protocol/src/constants.ts:103](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L103)
Secret of the "Public" channel every Companion radio ships with (`PUBLIC_GROUP_PSK` in the firmware's
`examples/companion_radio/MyMesh.cpp`). Identify Public by this secret, never by its name.
# PUB_KEY_PREFIX_SIZE (/docs/protocol/reference/variables/PUB_KEY_PREFIX_SIZE)
```ts
const PUB_KEY_PREFIX_SIZE: 6 = 6;
```
Defined in: [packages/protocol/src/constants.ts:90](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L90)
The public-key prefix that identifies a sender in received messages, in bytes.
# PUB_KEY_SIZE (/docs/protocol/reference/variables/PUB_KEY_SIZE)
```ts
const PUB_KEY_SIZE: 32 = 32;
```
Defined in: [packages/protocol/src/constants.ts:88](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L88)
A public key, in bytes (64 hex characters).
# PushCode (/docs/protocol/reference/variables/PushCode)
```ts
const PushCode: object;
```
Defined in: [packages/protocol/src/constants.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L49)
First byte of a radio → app push, sent without a command (0x80 and above).
## Type Declaration [#type-declaration]
### Advert [#advert]
```ts
readonly Advert: 128 = 0x80;
```
### ContactDeleted [#contactdeleted]
```ts
readonly ContactDeleted: 143 = 0x8f;
```
### ContactsFull [#contactsfull]
```ts
readonly ContactsFull: 144 = 0x90;
```
### MsgWaiting [#msgwaiting]
```ts
readonly MsgWaiting: 131 = 0x83;
```
### NewAdvert [#newadvert]
```ts
readonly NewAdvert: 138 = 0x8a;
```
### PathUpdated [#pathupdated]
```ts
readonly PathUpdated: 129 = 0x81;
```
### SendConfirmed [#sendconfirmed]
```ts
readonly SendConfirmed: 130 = 0x82;
```
# RadioErrorCode (/docs/protocol/reference/variables/RadioErrorCode)
```ts
const RadioErrorCode: object;
```
Defined in: [packages/protocol/src/constants.ts:60](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L60)
The `errorCode` of an `Err` response.
## Type Declaration [#type-declaration]
### BadState [#badstate]
```ts
readonly BadState: 4 = 4;
```
### FileIoError [#fileioerror]
```ts
readonly FileIoError: 5 = 5;
```
### IllegalArg [#illegalarg]
```ts
readonly IllegalArg: 6 = 6;
```
### NotFound [#notfound]
```ts
readonly NotFound: 2 = 2;
```
### TableFull [#tablefull]
```ts
readonly TableFull: 3 = 3;
```
### UnsupportedCmd [#unsupportedcmd]
```ts
readonly UnsupportedCmd: 1 = 1;
```
# ResponseCode (/docs/protocol/reference/variables/ResponseCode)
```ts
const ResponseCode: object;
```
Defined in: [packages/protocol/src/constants.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L27)
First byte of a radio → app response (below 0x80).
## Type Declaration [#type-declaration]
### BattAndStorage [#battandstorage]
```ts
readonly BattAndStorage: 12 = 12;
```
### ChannelInfo [#channelinfo]
```ts
readonly ChannelInfo: 18 = 18;
```
### ChannelMsgRecv [#channelmsgrecv]
```ts
readonly ChannelMsgRecv: 8 = 8;
```
### ChannelMsgRecvV3 [#channelmsgrecvv3]
```ts
readonly ChannelMsgRecvV3: 17 = 17;
```
### Contact [#contact]
```ts
readonly Contact: 3 = 3;
```
### ContactMsgRecv [#contactmsgrecv]
```ts
readonly ContactMsgRecv: 7 = 7;
```
### ContactMsgRecvV3 [#contactmsgrecvv3]
```ts
readonly ContactMsgRecvV3: 16 = 16;
```
### ContactsStart [#contactsstart]
```ts
readonly ContactsStart: 2 = 2;
```
### CurrTime [#currtime]
```ts
readonly CurrTime: 9 = 9;
```
### DeviceInfo [#deviceinfo]
```ts
readonly DeviceInfo: 13 = 13;
```
### Disabled [#disabled]
```ts
readonly Disabled: 15 = 15;
```
### EndOfContacts [#endofcontacts]
```ts
readonly EndOfContacts: 4 = 4;
```
### Err [#err]
```ts
readonly Err: 1 = 1;
```
### ExportContact [#exportcontact]
```ts
readonly ExportContact: 11 = 11;
```
### NoMoreMessages [#nomoremessages]
```ts
readonly NoMoreMessages: 10 = 10;
```
### Ok [#ok]
```ts
readonly Ok: 0 = 0;
```
### SelfInfo [#selfinfo]
```ts
readonly SelfInfo: 5 = 5;
```
### Sent [#sent]
```ts
readonly Sent: 6 = 6;
```
# TO_RADIO_MARKER (/docs/protocol/reference/variables/TO_RADIO_MARKER)
```ts
const TO_RADIO_MARKER: 60 = 0x3c;
```
Defined in: [packages/protocol/src/framing.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/framing.ts#L4)
The `'<'` byte opening an app → radio serial/TCP frame.
# TxtType (/docs/protocol/reference/variables/TxtType)
```ts
const TxtType: object;
```
Defined in: [packages/protocol/src/constants.ts:79](https://github.com/meshcorejs/meshcore.js/blob/main/packages/protocol/src/constants.ts#L79)
The `txtType` of a text message: plain, CLI data, or signed plain.
## Type Declaration [#type-declaration]
### CliData [#clidata]
```ts
readonly CliData: 1 = 1;
```
### Plain [#plain]
```ts
readonly Plain: 0 = 0;
```
### SignedPlain [#signedplain]
```ts
readonly SignedPlain: 2 = 2;
```
# FakeRadio (/docs/testing/reference/classes/FakeRadio)
Defined in: [packages/transports/src/mock/fake-radio.ts:92](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L92)
Emulates the Companion firmware (`FIRMWARE_VER_CODE` 13) for the v1 command subset, attached to a
[MockTransport](./MockTransport.md). Used by `@meshcorejs/testing` and every test that needs a radio without hardware.
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new FakeRadio(options?): FakeRadio;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:113](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L113)
#### Parameters [#parameters]
##### options? [#options]
[`FakeRadioOptions`](../interfaces/FakeRadioOptions.md) = `{}`
Initial self, device, contacts, channels and clock
#### Returns [#returns]
`FakeRadio`
## Properties [#properties]
### ackDelayMs [#ackdelayms]
```ts
ackDelayMs: number = 50;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:101](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L101)
***
### ackMode [#ackmode]
```ts
ackMode: AckMode = 'auto';
```
Defined in: [packages/transports/src/mock/fake-radio.ts:100](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L100)
***
### appTargetVersion [#apptargetversion]
```ts
appTargetVersion: number = 0;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:99](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L99)
***
### batteryMillivolts [#batterymillivolts]
```ts
batteryMillivolts: number = 4100;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:104](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L104)
***
### channels [#channels]
```ts
readonly channels: (ChannelRecord | null)[];
```
Defined in: [packages/transports/src/mock/fake-radio.ts:96](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L96)
***
### commands [#commands]
```ts
readonly commands: number[] = [];
```
Defined in: [packages/transports/src/mock/fake-radio.ts:98](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L98)
***
### contacts [#contacts]
```ts
readonly contacts: Map;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:95](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L95)
***
### device [#device]
```ts
readonly device: DeviceInfo;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L94)
***
### refuseSelfAdvert [#refuseselfadvert]
```ts
refuseSelfAdvert: boolean = false;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:103](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L103)
***
### self [#self]
```ts
readonly self: SelfInfo;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:93](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L93)
***
### selfAdvertPacket [#selfadvertpacket]
```ts
selfAdvertPacket: Uint8Array;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:106](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L106)
***
### sent [#sent]
```ts
readonly sent: FakeSentMessage[] = [];
```
Defined in: [packages/transports/src/mock/fake-radio.ts:97](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L97)
***
### suggestedTimeoutMs [#suggestedtimeoutms]
```ts
suggestedTimeoutMs: number;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:105](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L105)
***
### unresponsive [#unresponsive]
```ts
unresponsive: boolean = false;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:102](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L102)
## Accessors [#accessors]
### clock [#clock]
#### Get Signature [#get-signature]
```ts
get clock(): number;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:149](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L149)
##### Returns [#returns-1]
`number`
***
### pendingMessages [#pendingmessages]
#### Get Signature [#get-signature-1]
```ts
get pendingMessages(): number;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:246](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L246)
##### Returns [#returns-2]
`number`
## Methods [#methods]
### ack() [#ack]
```ts
ack(expectedAck, roundTripMs?): void;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:242](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L242)
#### Parameters [#parameters-1]
##### expectedAck [#expectedack]
`number`
Value announced by SENT
##### roundTripMs? [#roundtripms]
`number` = `1200`
Delay reported in the ACK. Default 1200
#### Returns [#returns-3]
`void`
***
### attach() [#attach]
```ts
attach(transport): this;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:154](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L154)
#### Parameters [#parameters-2]
##### transport [#transport]
[`MockTransport`](./MockTransport.md)
MockTransport this radio answers
#### Returns [#returns-4]
`this`
***
### deleteContact() [#deletecontact]
```ts
deleteContact(publicKey): void;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:233](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L233)
#### Parameters [#parameters-3]
##### publicKey [#publickey]
`string`
Contact key
#### Returns [#returns-5]
`void`
***
### hearAdvert() [#hearadvert]
```ts
hearAdvert(contact): void;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:207](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L207)
#### Parameters [#parameters-4]
##### contact [#contact]
`ContactRecord`
Record of the node heard
#### Returns [#returns-6]
`void`
***
### receiveChannelMessage() [#receivechannelmessage]
```ts
receiveChannelMessage(params): void;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:185](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L185)
#### Parameters [#parameters-5]
##### params [#params]
channelIndex, senderName, text, and optional snr and hops
###### channelIndex [#channelindex]
`number`
###### hops? [#hops]
`number`
###### senderName [#sendername]
`string`
###### senderTimestamp? [#sendertimestamp]
`number`
###### snr? [#snr]
`number`
###### text [#text]
`string`
#### Returns [#returns-7]
`void`
***
### receiveContactMessage() [#receivecontactmessage]
```ts
receiveContactMessage(params): void;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:161](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L161)
#### Parameters [#parameters-6]
##### params [#params-1]
from, text, and optional snr, hops and senderTimestamp
###### from [#from]
`string`
###### hops? [#hops-1]
`number`
###### senderTimestamp? [#sendertimestamp-1]
`number`
###### snr? [#snr-1]
`number`
###### text [#text-1]
`string`
#### Returns [#returns-8]
`void`
***
### updatePath() [#updatepath]
```ts
updatePath(publicKey, outPath): void;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:224](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L224)
#### Parameters [#parameters-7]
##### publicKey [#publickey-1]
`string`
Contact key
##### outPath [#outpath]
`Path` | `null`
New path, null for flood
#### Returns [#returns-9]
`void`
# MockTransport (/docs/testing/reference/classes/MockTransport)
Defined in: [packages/transports/src/mock/mock-transport.ts:9](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L9)
In-memory `Transport`: the app's writes go to a handler, `receive()` emits a frame as if the radio sent it, `simulateDisconnect()` a lost link.
## Extends [#extends]
* `TypedEmitter`\<`TransportEvents`>
## Implements [#implements]
* `Transport`
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new MockTransport(): MockTransport;
```
#### Returns [#returns]
`MockTransport`
#### Inherited from [#inherited-from]
```ts
TypedEmitter.constructor
```
## Properties [#properties]
### connectCount [#connectcount]
```ts
connectCount: number = 0;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L15)
***
### kind [#kind]
```ts
readonly kind: "mock" = 'mock';
```
Defined in: [packages/transports/src/mock/mock-transport.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L10)
#### Implementation of [#implementation-of]
```ts
Transport.kind
```
***
### written [#written]
```ts
readonly written: Uint8Array[] = [];
```
Defined in: [packages/transports/src/mock/mock-transport.ts:11](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L11)
## Accessors [#accessors]
### connected [#connected]
#### Get Signature [#get-signature]
```ts
get connected(): boolean;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L17)
##### Returns [#returns-1]
`boolean`
#### Implementation of [#implementation-of-1]
```ts
Transport.connected
```
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:51](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L51)
#### Returns [#returns-2]
`Promise`\<`void`>
#### Implementation of [#implementation-of-2]
```ts
Transport.close
```
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:32](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L32)
#### Parameters [#parameters]
##### signal? [#signal]
`AbortSignal`
Aborts the connection attempt
#### Returns [#returns-3]
`Promise`\<`void`>
#### Implementation of [#implementation-of-3]
```ts
Transport.connect
```
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-1]
##### event [#event]
`K`
Event name
##### args [#args]
...`TransportEvents`\[`K`]
Event arguments
#### Returns [#returns-4]
`boolean`
#### Implementation of [#implementation-of-4]
```ts
Transport.emit
```
#### Inherited from [#inherited-from-1]
```ts
TypedEmitter.emit
```
***
### failNextConnect() [#failnextconnect]
```ts
failNextConnect(error?): void;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L27)
#### Parameters [#parameters-2]
##### error? [#error]
`Error` = `...`
Rejection of the next connect. Default a ConnectionError
#### Returns [#returns-5]
`void`
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-6]
`number`
#### Implementation of [#implementation-of-5]
```ts
Transport.listenerCount
```
#### Inherited from [#inherited-from-2]
```ts
TypedEmitter.listenerCount
```
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
`Listener`\<`TransportEvents`\[`K`]>
Listener to remove
#### Returns [#returns-7]
`this`
#### Implementation of [#implementation-of-6]
```ts
Transport.off
```
#### Inherited from [#inherited-from-3]
```ts
TypedEmitter.off
```
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
`Listener`\<`TransportEvents`\[`K`]>
Called with the event arguments
#### Returns [#returns-8]
`this`
#### Implementation of [#implementation-of-7]
```ts
Transport.on
```
#### Inherited from [#inherited-from-4]
```ts
TypedEmitter.on
```
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
`Listener`\<`TransportEvents`\[`K`]>
Called once with the event arguments
#### Returns [#returns-9]
`this`
#### Implementation of [#implementation-of-8]
```ts
Transport.once
```
#### Inherited from [#inherited-from-5]
```ts
TypedEmitter.once
```
***
### receive() [#receive]
```ts
receive(payload): void;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:56](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L56)
#### Parameters [#parameters-7]
##### payload [#payload]
`Uint8Array`
Frame payload from the radio
#### Returns [#returns-10]
`void`
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-8]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-11]
`this`
#### Implementation of [#implementation-of-9]
```ts
Transport.removeAllListeners
```
#### Inherited from [#inherited-from-6]
```ts
TypedEmitter.removeAllListeners
```
***
### setRadio() [#setradio]
```ts
setRadio(handler): void;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L22)
#### Parameters [#parameters-9]
##### handler [#handler]
`RadioHandler` | `null`
Answers the written frames, or null
#### Returns [#returns-12]
`void`
***
### simulateDisconnect() [#simulatedisconnect]
```ts
simulateDisconnect(error?): void;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:63](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L63)
#### Parameters [#parameters-10]
##### error? [#error-1]
`Error` = `...`
Reason given to the close event
#### Returns [#returns-13]
`void`
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/mock/mock-transport.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/mock-transport.ts#L45)
#### Parameters [#parameters-11]
##### payload [#payload-1]
`Uint8Array`
Frame payload without framing
#### Returns [#returns-14]
`Promise`\<`void`>
#### Implementation of [#implementation-of-10]
```ts
Transport.write
```
# createTestClient() (/docs/testing/reference/functions/createTestClient)
```ts
function createTestClient(options?): Promise;
```
Defined in: [packages/testing/src/test-client.ts:74](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L74)
Start a `Client` on a `FakeRadio` through a `MockTransport`, with `@sinonjs/fake-timers` installed, and log it in. Call `destroy()` when the test ends.
## Parameters [#parameters]
### options? [#options]
[`TestClientOptions`](../interfaces/TestClientOptions.md) = `{}`
load, self, now, maxChannels, radio, replies and fakeRadio
## Returns [#returns]
`Promise`\<[`TestBot`](../interfaces/TestBot.md)>
# fakeContactKey() (/docs/testing/reference/functions/fakeContactKey)
```ts
function fakeContactKey(name): string;
```
Defined in: [packages/testing/src/index.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/index.ts#L15)
The public key `fakeContactRecord({ name })` gives to `name`, to reference a fake contact in roles or assertions.
## Parameters [#parameters]
### name [#name]
`string`
## Returns [#returns]
`string`
# fakeContactRecord() (/docs/testing/reference/functions/fakeContactRecord)
```ts
function fakeContactRecord(overrides): ContactRecord;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:477](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L477)
A `ContactRecord` for tests: the public key is derived from the name, every other field has a plausible default.
## Parameters [#parameters]
### overrides [#overrides]
`Partial`\<`ContactRecord`> & `object`
name is required, the key is derived from it
## Returns [#returns]
`ContactRecord`
# parseDuration() (/docs/testing/reference/functions/parseDuration)
```ts
function parseDuration(duration): number;
```
Defined in: [packages/testing/src/duration.ts:4](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/duration.ts#L4)
Milliseconds of a duration given as a number or as `"30s"`, `"5m"`, `"1d"` (units: ms, s, m, h, d); what `bot.advanceTime()` accepts.
## Parameters [#parameters]
### duration [#duration]
`string` | `number`
## Returns [#returns]
`number`
# FakeRadioOptions (/docs/testing/reference/interfaces/FakeRadioOptions)
Defined in: [packages/transports/src/mock/fake-radio.ts:42](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L42)
Initial state of a `FakeRadio`: self info, device info, contacts, channels, clock, the ack timeout it suggests and its own advert packet.
## Properties [#properties]
### channels? [#channels]
```ts
optional channels?: object[];
```
Defined in: [packages/transports/src/mock/fake-radio.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L46)
#### index [#index]
```ts
index: number;
```
#### name [#name]
```ts
name: string;
```
#### secret [#secret]
```ts
secret: Uint8Array;
```
***
### clock? [#clock]
```ts
optional clock?: number;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L47)
***
### contacts? [#contacts]
```ts
optional contacts?: ContactRecord[];
```
Defined in: [packages/transports/src/mock/fake-radio.ts:45](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L45)
***
### device? [#device]
```ts
optional device?: Partial;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L44)
***
### self? [#self]
```ts
optional self?: Partial;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:43](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L43)
***
### selfAdvertPacket? [#selfadvertpacket]
```ts
optional selfAdvertPacket?: Uint8Array;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L49)
***
### suggestedTimeoutMs? [#suggestedtimeoutms]
```ts
optional suggestedTimeoutMs?: number;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:48](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L48)
# TestBot (/docs/testing/reference/interfaces/TestBot)
Defined in: [packages/testing/src/test-client.ts:27](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L27)
A logged-in bot on a fake radio with simulated time: send it DMs and channel messages, read what it put on the air, advance the clock, and destroy it.
## Properties [#properties]
### client [#client]
```ts
readonly client: Client;
```
Defined in: [packages/testing/src/test-client.ts:28](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L28)
***
### clock [#clock]
```ts
readonly clock: Clock;
```
Defined in: [packages/testing/src/test-client.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L31)
***
### radio [#radio]
```ts
readonly radio: FakeRadio;
```
Defined in: [packages/testing/src/test-client.ts:29](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L29)
***
### transport [#transport]
```ts
readonly transport: MockTransport;
```
Defined in: [packages/testing/src/test-client.ts:30](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L30)
## Methods [#methods]
### advanceTime() [#advancetime]
```ts
advanceTime(duration): Promise;
```
Defined in: [packages/testing/src/test-client.ts:61](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L61)
#### Parameters [#parameters]
##### duration [#duration]
`string` | `number`
Milliseconds, or a string like 30s, 5m, 1h, 1d
#### Returns [#returns]
`Promise`\<`void`>
***
### channel() [#channel]
```ts
channel(
channelName,
authorName,
text
): Promise;
```
Defined in: [packages/testing/src/test-client.ts:57](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L57)
#### Parameters [#parameters-1]
##### channelName [#channelname]
`string`
Channel name
##### authorName [#authorname]
`string`
Sender name
##### text [#text]
`string`
Message text
#### Returns [#returns-1]
`Promise`\<`string`\[]>
***
### destroy() [#destroy]
```ts
destroy(): Promise;
```
Defined in: [packages/testing/src/test-client.ts:64](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L64)
#### Returns [#returns-2]
`Promise`\<`void`>
***
### dm() [#dm]
```ts
dm(from, text): Promise;
```
Defined in: [packages/testing/src/test-client.ts:51](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L51)
#### Parameters [#parameters-2]
##### from [#from]
`string` | `Contact`
Contact or its name
##### text [#text-1]
`string`
Message text
#### Returns [#returns-3]
`Promise`\<`string`\[]>
***
### fakeChannel() [#fakechannel]
```ts
fakeChannel(name, secret?): Channel;
```
Defined in: [packages/testing/src/test-client.ts:41](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L41)
#### Parameters [#parameters-3]
##### name [#name]
`string`
Channel name
##### secret? [#secret]
`Uint8Array`\<`ArrayBufferLike`>
16 bytes, derived from the name when omitted
#### Returns [#returns-4]
`Channel`
***
### fakeContact() [#fakecontact]
```ts
fakeContact(name, overrides?): Contact;
```
Defined in: [packages/testing/src/test-client.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L36)
#### Parameters [#parameters-4]
##### name [#name-1]
`string`
Contact name, the key is derived from it
##### overrides? [#overrides]
`Partial`\<`ContactRecord`>
Contact record fields
#### Returns [#returns-5]
`Contact`
***
### sentTo() [#sentto]
```ts
sentTo(target): string[];
```
Defined in: [packages/testing/src/test-client.ts:63](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L63)
#### Parameters [#parameters-5]
##### target [#target]
`string`
Channel name, contact name or key prefix
#### Returns [#returns-6]
`string`\[]
***
### setRoleMembers() [#setrolemembers]
```ts
setRoleMembers(role, members): void;
```
Defined in: [packages/testing/src/test-client.ts:46](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L46)
#### Parameters [#parameters-6]
##### role [#role]
`string`
Role name
##### members [#members]
(`string` | `Contact`)\[]
Contacts or public keys
#### Returns [#returns-7]
`void`
***
### setTime() [#settime]
```ts
setTime(date): Promise;
```
Defined in: [packages/testing/src/test-client.ts:59](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L59)
#### Parameters [#parameters-7]
##### date [#date]
`string` | `number` | `Date`
New simulated time
#### Returns [#returns-8]
`Promise`\<`void`>
# TestClientOptions (/docs/testing/reference/interfaces/TestClientOptions)
Defined in: [packages/testing/src/test-client.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L16)
How to set up a test bot: bricks to `load`, the radio's self info, the starting date, channel count, `RadioConfig`, replies, and the rest of the `FakeRadio` options.
## Properties [#properties]
### fakeRadio? [#fakeradio]
```ts
optional fakeRadio?: Omit;
```
Defined in: [packages/testing/src/test-client.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L23)
***
### load? [#load]
```ts
optional load?: string | URL;
```
Defined in: [packages/testing/src/test-client.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L17)
***
### maxChannels? [#maxchannels]
```ts
optional maxChannels?: number;
```
Defined in: [packages/testing/src/test-client.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L20)
***
### now? [#now]
```ts
optional now?: string | number | Date;
```
Defined in: [packages/testing/src/test-client.ts:19](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L19)
***
### radio? [#radio]
```ts
optional radio?: RadioConfig;
```
Defined in: [packages/testing/src/test-client.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L21)
***
### replies? [#replies]
```ts
optional replies?: Partial;
```
Defined in: [packages/testing/src/test-client.ts:22](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L22)
***
### self? [#self]
```ts
optional self?: Partial;
```
Defined in: [packages/testing/src/test-client.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/testing/src/test-client.ts#L18)
# AckMode (/docs/testing/reference/type-aliases/AckMode)
```ts
type AckMode = "auto" | "manual" | "never";
```
Defined in: [packages/transports/src/mock/fake-radio.ts:53](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L53)
How [FakeRadio](../classes/FakeRadio.md) acknowledges direct messages: `auto` right away, `manual` on `ack()`, `never`.
# FakeSentMessage (/docs/testing/reference/type-aliases/FakeSentMessage)
```ts
type FakeSentMessage = FakeSentDirectMessage | FakeSentChannelMessage;
```
Defined in: [packages/transports/src/mock/fake-radio.ts:78](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/mock/fake-radio.ts#L78)
One message [FakeRadio](../classes/FakeRadio.md) recorded as sent by the app, direct or on a channel.
# @meshcorejs/transports (/docs/transports/reference/main)
## Classes [#classes]
* [BleTransport](./classes/BleTransport.md)
* [ConnectionError](./classes/ConnectionError.md)
* [MeshcoreError](./classes/MeshcoreError.md)
* [MissingDependencyError](./classes/MissingDependencyError.md)
* [SerialTransport](./classes/SerialTransport.md)
* [TcpTransport](./classes/TcpTransport.md)
* [TypedEmitter](./classes/TypedEmitter.md)
## Interfaces [#interfaces]
* [BleTransportDeps](./interfaces/BleTransportDeps.md)
* [BleTransportOptions](./interfaces/BleTransportOptions.md)
* [NobleCharacteristicLike](./interfaces/NobleCharacteristicLike.md)
* [NobleLike](./interfaces/NobleLike.md)
* [NoblePeripheralLike](./interfaces/NoblePeripheralLike.md)
* [SerialPortLike](./interfaces/SerialPortLike.md)
* [SerialPortModule](./interfaces/SerialPortModule.md)
* [SerialTransportDeps](./interfaces/SerialTransportDeps.md)
* [SerialTransportOptions](./interfaces/SerialTransportOptions.md)
* [TcpTransportOptions](./interfaces/TcpTransportOptions.md)
* [Transport](./interfaces/Transport.md)
* [TransportEvents](./interfaces/TransportEvents.md)
## Type Aliases [#type-aliases]
* [EventMap](./type-aliases/EventMap.md)
* [Listener](./type-aliases/Listener.md)
* [TransportKind](./type-aliases/TransportKind.md)
## Variables [#variables]
* [BLE\_RX\_CHARACTERISTIC\_UUID](./variables/BLE_RX_CHARACTERISTIC_UUID.md)
* [BLE\_SERVICE\_UUID](./variables/BLE_SERVICE_UUID.md)
* [BLE\_TX\_CHARACTERISTIC\_UUID](./variables/BLE_TX_CHARACTERISTIC_UUID.md)
## Functions [#functions]
* [importOptional](./functions/importOptional.md)
# @meshcorejs/transports/mock (/docs/transports/reference/mock)
## Classes [#classes]
* [FakeRadio](./classes/FakeRadio.md)
* [MockTransport](./classes/MockTransport.md)
## Interfaces [#interfaces]
* [FakeRadioOptions](./interfaces/FakeRadioOptions.md)
* [FakeSentChannelMessage](./interfaces/FakeSentChannelMessage.md)
* [FakeSentDirectMessage](./interfaces/FakeSentDirectMessage.md)
## Type Aliases [#type-aliases]
* [AckMode](./type-aliases/AckMode.md)
* [FakeSentMessage](./type-aliases/FakeSentMessage.md)
* [RadioHandler](./type-aliases/RadioHandler.md)
## Functions [#functions]
* [fakeContactRecord](./functions/fakeContactRecord.md)
# BleTransport (/docs/transports/reference/main/classes/BleTransport)
Defined in: [packages/transports/src/ble.ts:66](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L66)
Transport over Bluetooth Low Energy (Nordic UART): scans for the radio, connects, one notification or write per frame. Needs `@abandonware/noble` installed.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)>
## Implements [#implements]
* [`Transport`](../interfaces/Transport.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new BleTransport(options?, deps?): BleTransport;
```
Defined in: [packages/transports/src/ble.ts:76](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L76)
#### Parameters [#parameters]
##### options? [#options]
[`BleTransportOptions`](../interfaces/BleTransportOptions.md) = `{}`
address or name of the radio, scanTimeoutMs. Default 15000
##### deps? [#deps]
[`BleTransportDeps`](../interfaces/BleTransportDeps.md) = `{}`
Test seam replacing the noble import
#### Returns [#returns]
`BleTransport`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Properties [#properties]
### kind [#kind]
```ts
readonly kind: "ble" = 'ble';
```
Defined in: [packages/transports/src/ble.ts:67](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L67)
#### Implementation of [#implementation-of]
[`Transport`](../interfaces/Transport.md).[`kind`](../interfaces/Transport.md#kind)
## Accessors [#accessors]
### connected [#connected]
#### Get Signature [#get-signature]
```ts
get connected(): boolean;
```
Defined in: [packages/transports/src/ble.ts:83](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L83)
##### Returns [#returns-1]
`boolean`
#### Implementation of [#implementation-of-1]
[`Transport`](../interfaces/Transport.md).[`connected`](../interfaces/Transport.md#connected)
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/ble.ts:204](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L204)
#### Returns [#returns-2]
`Promise`\<`void`>
#### Implementation of [#implementation-of-2]
[`Transport`](../interfaces/Transport.md).[`close`](../interfaces/Transport.md#close)
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/ble.ts:88](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L88)
#### Parameters [#parameters-1]
##### signal? [#signal]
`AbortSignal`
Aborts the connection attempt
#### Returns [#returns-3]
`Promise`\<`void`>
#### Implementation of [#implementation-of-3]
[`Transport`](../interfaces/Transport.md).[`connect`](../interfaces/Transport.md#connect)
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]
Event arguments
#### Returns [#returns-4]
`boolean`
#### Implementation of [#implementation-of-4]
[`Transport`](../interfaces/Transport.md).[`emit`](../interfaces/Transport.md#emit)
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-5]
`number`
#### Implementation of [#implementation-of-5]
[`Transport`](../interfaces/Transport.md).[`listenerCount`](../interfaces/Transport.md#listenercount)
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Listener to remove
#### Returns [#returns-6]
`this`
#### Implementation of [#implementation-of-6]
[`Transport`](../interfaces/Transport.md).[`off`](../interfaces/Transport.md#off)
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Called with the event arguments
#### Returns [#returns-7]
`this`
#### Implementation of [#implementation-of-7]
[`Transport`](../interfaces/Transport.md).[`on`](../interfaces/Transport.md#on)
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Called once with the event arguments
#### Returns [#returns-8]
`this`
#### Implementation of [#implementation-of-8]
[`Transport`](../interfaces/Transport.md).[`once`](../interfaces/Transport.md#once)
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-9]
`this`
#### Implementation of [#implementation-of-9]
[`Transport`](../interfaces/Transport.md).[`removeAllListeners`](../interfaces/Transport.md#removealllisteners)
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/ble.ts:194](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/ble.ts#L194)
#### Parameters [#parameters-8]
##### payload [#payload]
`Uint8Array`
Frame payload without framing
#### Returns [#returns-10]
`Promise`\<`void`>
#### Implementation of [#implementation-of-10]
[`Transport`](../interfaces/Transport.md).[`write`](../interfaces/Transport.md#write)
# ConnectionError (/docs/transports/reference/main/classes/ConnectionError)
Defined in: [packages/transports/src/errors.ts:13](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L13)
The transport could not connect, or the connection was lost (`code: 'CONNECTION_FAILED'`).
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new ConnectionError(message, options?): ConnectionError;
```
Defined in: [packages/transports/src/errors.ts:14](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L14)
#### Parameters [#parameters]
##### message [#message]
`string`
##### options? [#options]
`ErrorOptions`
#### Returns [#returns]
`ConnectionError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
# MeshcoreError (/docs/transports/reference/main/classes/MeshcoreError)
Defined in: [packages/transports/src/errors.ts:2](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L2)
Base class of the library's errors: `code` identifies the kind without parsing the message.
## Extends [#extends]
* `Error`
## Extended by [#extended-by]
* [`ConnectionError`](./ConnectionError.md)
* [`MissingDependencyError`](./MissingDependencyError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new MeshcoreError(
code,
message,
options?
): MeshcoreError;
```
Defined in: [packages/transports/src/errors.ts:5](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L5)
#### Parameters [#parameters]
##### code [#code]
`string`
##### message [#message]
`string`
##### options? [#options]
`ErrorOptions`
#### Returns [#returns]
`MeshcoreError`
#### Overrides [#overrides]
```ts
Error.constructor
```
## Properties [#properties]
### code [#code-1]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
# MissingDependencyError (/docs/transports/reference/main/classes/MissingDependencyError)
Defined in: [packages/transports/src/errors.ts:20](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L20)
An optional dependency (`serialport`, `@abandonware/noble`) is not installed; the message says what to run.
## Extends [#extends]
* [`MeshcoreError`](./MeshcoreError.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new MissingDependencyError(moduleName, options?): MissingDependencyError;
```
Defined in: [packages/transports/src/errors.ts:23](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L23)
#### Parameters [#parameters]
##### moduleName [#modulename]
`string`
##### options? [#options]
`ErrorOptions`
#### Returns [#returns]
`MissingDependencyError`
#### Overrides [#overrides]
[`MeshcoreError`](./MeshcoreError.md).[`constructor`](./MeshcoreError.md#constructor)
## Properties [#properties]
### code [#code]
```ts
readonly code: string;
```
Defined in: [packages/transports/src/errors.ts:3](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L3)
#### Inherited from [#inherited-from]
[`MeshcoreError`](./MeshcoreError.md).[`code`](./MeshcoreError.md#code)
***
### moduleName [#modulename-1]
```ts
readonly moduleName: string;
```
Defined in: [packages/transports/src/errors.ts:21](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/errors.ts#L21)
# SerialTransport (/docs/transports/reference/main/classes/SerialTransport)
Defined in: [packages/transports/src/serial.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L35)
Transport over USB serial with the `'<'` / `'>'` framing. Needs `serialport` installed.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)>
## Implements [#implements]
* [`Transport`](../interfaces/Transport.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new SerialTransport(options, deps?): SerialTransport;
```
Defined in: [packages/transports/src/serial.ts:47](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L47)
#### Parameters [#parameters]
##### options [#options]
[`SerialTransportOptions`](../interfaces/SerialTransportOptions.md)
path and baudRate. Default 115200
##### deps? [#deps]
[`SerialTransportDeps`](../interfaces/SerialTransportDeps.md) = `{}`
Test seam replacing the serialport import
#### Returns [#returns]
`SerialTransport`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Properties [#properties]
### baudRate [#baudrate]
```ts
readonly baudRate: number;
```
Defined in: [packages/transports/src/serial.ts:38](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L38)
***
### kind [#kind]
```ts
readonly kind: "serial" = 'serial';
```
Defined in: [packages/transports/src/serial.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L36)
#### Implementation of [#implementation-of]
[`Transport`](../interfaces/Transport.md).[`kind`](../interfaces/Transport.md#kind)
***
### path [#path]
```ts
readonly path: string;
```
Defined in: [packages/transports/src/serial.ts:37](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L37)
## Accessors [#accessors]
### connected [#connected]
#### Get Signature [#get-signature]
```ts
get connected(): boolean;
```
Defined in: [packages/transports/src/serial.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L54)
##### Returns [#returns-1]
`boolean`
#### Implementation of [#implementation-of-1]
[`Transport`](../interfaces/Transport.md).[`connected`](../interfaces/Transport.md#connected)
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/serial.ts:108](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L108)
#### Returns [#returns-2]
`Promise`\<`void`>
#### Implementation of [#implementation-of-2]
[`Transport`](../interfaces/Transport.md).[`close`](../interfaces/Transport.md#close)
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/serial.ts:59](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L59)
#### Parameters [#parameters-1]
##### signal? [#signal]
`AbortSignal`
Aborts the connection attempt
#### Returns [#returns-3]
`Promise`\<`void`>
#### Implementation of [#implementation-of-3]
[`Transport`](../interfaces/Transport.md).[`connect`](../interfaces/Transport.md#connect)
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]
Event arguments
#### Returns [#returns-4]
`boolean`
#### Implementation of [#implementation-of-4]
[`Transport`](../interfaces/Transport.md).[`emit`](../interfaces/Transport.md#emit)
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-5]
`number`
#### Implementation of [#implementation-of-5]
[`Transport`](../interfaces/Transport.md).[`listenerCount`](../interfaces/Transport.md#listenercount)
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Listener to remove
#### Returns [#returns-6]
`this`
#### Implementation of [#implementation-of-6]
[`Transport`](../interfaces/Transport.md).[`off`](../interfaces/Transport.md#off)
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Called with the event arguments
#### Returns [#returns-7]
`this`
#### Implementation of [#implementation-of-7]
[`Transport`](../interfaces/Transport.md).[`on`](../interfaces/Transport.md#on)
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Called once with the event arguments
#### Returns [#returns-8]
`this`
#### Implementation of [#implementation-of-8]
[`Transport`](../interfaces/Transport.md).[`once`](../interfaces/Transport.md#once)
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-9]
`this`
#### Implementation of [#implementation-of-9]
[`Transport`](../interfaces/Transport.md).[`removeAllListeners`](../interfaces/Transport.md#removealllisteners)
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/serial.ts:96](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/serial.ts#L96)
#### Parameters [#parameters-8]
##### payload [#payload]
`Uint8Array`
Frame payload without framing
#### Returns [#returns-10]
`Promise`\<`void`>
#### Implementation of [#implementation-of-10]
[`Transport`](../interfaces/Transport.md).[`write`](../interfaces/Transport.md#write)
# TcpTransport (/docs/transports/reference/main/classes/TcpTransport)
Defined in: [packages/transports/src/tcp.ts:15](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L15)
Transport over WiFi (TCP) with the `'<'` / `'>'` framing. Needs nothing installed.
## Extends [#extends]
* [`TypedEmitter`](./TypedEmitter.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)>
## Implements [#implements]
* [`Transport`](../interfaces/Transport.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new TcpTransport(options): TcpTransport;
```
Defined in: [packages/transports/src/tcp.ts:24](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L24)
#### Parameters [#parameters]
##### options [#options]
[`TcpTransportOptions`](../interfaces/TcpTransportOptions.md)
host and port. Default port 5000
#### Returns [#returns]
`TcpTransport`
#### Overrides [#overrides]
[`TypedEmitter`](./TypedEmitter.md).[`constructor`](./TypedEmitter.md#constructor)
## Properties [#properties]
### host [#host]
```ts
readonly host: string;
```
Defined in: [packages/transports/src/tcp.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L17)
***
### kind [#kind]
```ts
readonly kind: "tcp" = 'tcp';
```
Defined in: [packages/transports/src/tcp.ts:16](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L16)
#### Implementation of [#implementation-of]
[`Transport`](../interfaces/Transport.md).[`kind`](../interfaces/Transport.md#kind)
***
### port [#port]
```ts
readonly port: number;
```
Defined in: [packages/transports/src/tcp.ts:18](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L18)
## Accessors [#accessors]
### connected [#connected]
#### Get Signature [#get-signature]
```ts
get connected(): boolean;
```
Defined in: [packages/transports/src/tcp.ts:31](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L31)
##### Returns [#returns-1]
`boolean`
#### Implementation of [#implementation-of-1]
[`Transport`](../interfaces/Transport.md).[`connected`](../interfaces/Transport.md#connected)
## Methods [#methods]
### close() [#close]
```ts
close(): Promise;
```
Defined in: [packages/transports/src/tcp.ts:106](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L106)
#### Returns [#returns-2]
`Promise`\<`void`>
#### Implementation of [#implementation-of-2]
[`Transport`](../interfaces/Transport.md).[`close`](../interfaces/Transport.md#close)
***
### connect() [#connect]
```ts
connect(signal?): Promise;
```
Defined in: [packages/transports/src/tcp.ts:36](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L36)
#### Parameters [#parameters-1]
##### signal? [#signal]
`AbortSignal`
Aborts the connection attempt
#### Returns [#returns-3]
`Promise`\<`void`>
#### Implementation of [#implementation-of-3]
[`Transport`](../interfaces/Transport.md).[`connect`](../interfaces/Transport.md#connect)
***
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters-2]
##### event [#event]
`K`
Event name
##### args [#args]
...[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]
Event arguments
#### Returns [#returns-4]
`boolean`
#### Implementation of [#implementation-of-4]
[`Transport`](../interfaces/Transport.md).[`emit`](../interfaces/Transport.md#emit)
#### Inherited from [#inherited-from]
[`TypedEmitter`](./TypedEmitter.md).[`emit`](./TypedEmitter.md#emit)
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-1]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-3]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-5]
`number`
#### Implementation of [#implementation-of-5]
[`Transport`](../interfaces/Transport.md).[`listenerCount`](../interfaces/Transport.md#listenercount)
#### Inherited from [#inherited-from-1]
[`TypedEmitter`](./TypedEmitter.md).[`listenerCount`](./TypedEmitter.md#listenercount)
***
### off() [#off]
```ts
off(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:35](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L35)
#### Type Parameters [#type-parameters-2]
##### K [#k-2]
`K` *extends* `string`
#### Parameters [#parameters-4]
##### event [#event-2]
`K`
Event name
##### listener [#listener]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Listener to remove
#### Returns [#returns-6]
`this`
#### Implementation of [#implementation-of-6]
[`Transport`](../interfaces/Transport.md).[`off`](../interfaces/Transport.md#off)
#### Inherited from [#inherited-from-2]
[`TypedEmitter`](./TypedEmitter.md).[`off`](./TypedEmitter.md#off)
***
### on() [#on]
```ts
on(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:17](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L17)
#### Type Parameters [#type-parameters-3]
##### K [#k-3]
`K` *extends* `string`
#### Parameters [#parameters-5]
##### event [#event-3]
`K`
Event name
##### listener [#listener-1]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Called with the event arguments
#### Returns [#returns-7]
`this`
#### Implementation of [#implementation-of-7]
[`Transport`](../interfaces/Transport.md).[`on`](../interfaces/Transport.md#on)
#### Inherited from [#inherited-from-3]
[`TypedEmitter`](./TypedEmitter.md).[`on`](./TypedEmitter.md#on)
***
### once() [#once]
```ts
once(event, listener): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:26](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L26)
#### Type Parameters [#type-parameters-4]
##### K [#k-4]
`K` *extends* `string`
#### Parameters [#parameters-6]
##### event [#event-4]
`K`
Event name
##### listener [#listener-2]
[`Listener`](../type-aliases/Listener.md)\<[`TransportEvents`](../interfaces/TransportEvents.md)\[`K`]>
Called once with the event arguments
#### Returns [#returns-8]
`this`
#### Implementation of [#implementation-of-8]
[`Transport`](../interfaces/Transport.md).[`once`](../interfaces/Transport.md#once)
#### Inherited from [#inherited-from-4]
[`TypedEmitter`](./TypedEmitter.md).[`once`](./TypedEmitter.md#once)
***
### removeAllListeners() [#removealllisteners]
```ts
removeAllListeners(event?): this;
```
Defined in: [packages/transports/src/typed-emitter.ts:54](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L54)
#### Type Parameters [#type-parameters-5]
##### K [#k-5]
`K` *extends* `string`
#### Parameters [#parameters-7]
##### event? [#event-5]
`K`
Event name, or every event when omitted
#### Returns [#returns-9]
`this`
#### Implementation of [#implementation-of-9]
[`Transport`](../interfaces/Transport.md).[`removeAllListeners`](../interfaces/Transport.md#removealllisteners)
#### Inherited from [#inherited-from-5]
[`TypedEmitter`](./TypedEmitter.md).[`removeAllListeners`](./TypedEmitter.md#removealllisteners)
***
### write() [#write]
```ts
write(payload): Promise;
```
Defined in: [packages/transports/src/tcp.ts:94](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/tcp.ts#L94)
#### Parameters [#parameters-8]
##### payload [#payload]
`Uint8Array`
Frame payload without framing
#### Returns [#returns-10]
`Promise`\<`void`>
#### Implementation of [#implementation-of-10]
[`Transport`](../interfaces/Transport.md).[`write`](../interfaces/Transport.md#write)
# TypedEmitter<Events> (/docs/transports/reference/main/classes/TypedEmitter)
Defined in: [packages/transports/src/typed-emitter.ts:10](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L10)
Minimal typed event emitter (`on`, `once`, `off`, `emit`) with no Node dependency, the base of every transport and of the `Client`.
## Extended by [#extended-by]
* [`BleTransport`](./BleTransport.md)
* [`SerialTransport`](./SerialTransport.md)
* [`TcpTransport`](./TcpTransport.md)
* [`Transport`](../interfaces/Transport.md)
* [`MockTransport`](../../mock/classes/MockTransport.md)
## Type Parameters [#type-parameters]
### Events [#events]
`Events` *extends* [`EventMap`](../type-aliases/EventMap.md)
## Constructors [#constructors]
### Constructor [#constructor]
```ts
new TypedEmitter(): TypedEmitter;
```
#### Returns [#returns]
`TypedEmitter`\<`Events`>
## Methods [#methods]
### emit() [#emit]
```ts
emit(event, ...args): boolean;
```
Defined in: [packages/transports/src/typed-emitter.ts:44](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L44)
#### Type Parameters [#type-parameters-1]
##### K [#k]
`K` *extends* `string`
#### Parameters [#parameters]
##### event [#event]
`K`
Event name
##### args [#args]
...`Events`\[`K`]
Event arguments
#### Returns [#returns-1]
`boolean`
***
### listenerCount() [#listenercount]
```ts
listenerCount(event): number;
```
Defined in: [packages/transports/src/typed-emitter.ts:49](https://github.com/meshcorejs/meshcore.js/blob/main/packages/transports/src/typed-emitter.ts#L49)
#### Type Parameters [#type-parameters-2]
##### K [#k-1]
`K` *extends* `string`
#### Parameters [#parameters-1]
##### event [#event-1]
`K`
Event name
#### Returns [#returns-2]
`number`
***
### off() [#off]
```ts
off