Documentation Settings: Broker

Settings: Broker

The Broker Settings page lets you configure Mosquitto directly from the BunkerM web UI. You do not need to edit mosquitto.conf manually - all essential settings are exposed here, and changes that require a broker restart will prompt you to confirm.

MQTT Port

The TCP port Mosquitto listens on for standard MQTT connections.

  • Default: 1900 (standard MQTT uses 1883)
Warning: Changing the MQTT port requires updating all connected devices. They will fail to connect until you reconfigure them with the new port. Coordinate this as a planned maintenance event in production.

WebSocket Port

The port for MQTT-over-WebSocket connections. Useful for browser-based MQTT clients. Disabled by default. Enable it and set a port to allow WebSocket-based MQTT clients to connect.

Max Connections

The maximum number of simultaneous MQTT client connections the broker will accept.

  • Default: -1 (unlimited)
  • Set a positive integer to cap connections. New attempts beyond this limit are rejected.

Max Inflight Messages

The maximum number of QoS 1 and QoS 2 messages that can be in transit (unacknowledged) for a single client at any time.

  • Default: 20
  • Lower this to reduce memory usage. Raise it for high-throughput clients.

Max Queued Messages

The maximum number of messages held in the queue for a persistent client (clean session = false) that is currently offline.

  • Default: 100
  • Messages beyond this limit are dropped when the queue is full.

Persistence

Controls whether Mosquitto saves state to disk so it survives restarts.

  • Enabled: retained messages, persistent subscriptions, and QoS 1/2 queued messages are saved to disk and restored on restart.
  • Disabled: all state is held in memory and lost on restart.

With BunkerM's persistent volume setup (mosquitto_data:/var/lib/mosquitto), persistence data is preserved across container restarts regardless of this setting.

Log Level

Controls how verbose the broker's log output is.

  • error - errors only
  • warning - errors and warnings
  • notice - connections, disconnections, significant events (recommended for production)
  • information - general operational information
  • debug - detailed diagnostic output (very verbose, use only for troubleshooting)

API Key

The API Key section shows the BunkerM internal API key. This key secures communication between the Next.js frontend and the FastAPI backend services inside the container. It is not related to MQTT client credentials and does not affect how devices authenticate with the broker.

  • View: click Show next to the API Key field.
  • Regenerate: click Regenerate Key. The new key is applied immediately - no container restart needed.

Applying Changes

  1. Modify the desired settings.
  2. Click Save or Apply.
  3. If the setting requires a broker restart (such as port changes), BunkerM prompts you to confirm.

A broker restart briefly disconnects all current clients. They will reconnect automatically according to their own reconnection logic. Settings that do not require a restart (such as log level) take effect immediately.