aedes-cli provides a command-line interface (CLI) for running an Aedes MQTT broker instance. It simplifies the deployment and configuration of an Aedes broker, allowing users to quickly set up an MQTT server with various options for host, port, protocols (TCP, TLS, WS, WSS), authentication, authorization, and persistence. The current stable version is 1.0.2. Releases are generally driven by updates to the underlying Aedes library or dependency bumps, with a focus on stability and ease of use for CLI operations. Its key differentiator is offering a batteries-included CLI wrapper around the highly customizable Aedes library, abstracting away much of the programmatic setup for common use cases.
npm install aedes-cliVerified import paths — ran on the pinned version, not inferred.
This code snippet demonstrates how to programmatically start the Aedes MQTT broker using `aedes-cli` with basic TCP and WebSockets protocols, and log connection events.
For programmatic usage, switch to ES Module import syntax (e.g., `import { start } from 'aedes-cli';`). Review `yargs` v18 documentation if you're interacting with its API directly within the CLI's programmatic capabilities.Attach an error listener to the returned server object: `server.on('error', (err) => { console.error('Broker error:', err); });` to prevent unexpected crashes.Use the `--host 0.0.0.0` command-line option, or set `host: '0.0.0.0'` when starting programmatically. For Docker, this is often necessary in your `docker run` command or `docker-compose.yml`.
Convert your project or the specific file to use ES Modules (`.mjs` extension or `"type": "module"` in `package.json`) and use `import { start } from 'aedes-cli';`.Stop the conflicting process, or specify a different port for aedes-cli using the `--port <new_port>` command-line option or `{ port: <new_port> }` in programmatic options.