Skip to main content

Crate mqtt_broker

Crate mqtt_broker 

Source
Expand description

mqtt-broker — an MQTT 3.1.1 / MQTT 5.0 broker written in Rust, exposed to other languages via UniFFI.

Reuses the wire-protocol codec from the mqtt-client crate (mqtt_client::protocol) rather than duplicating it — this workspace intentionally has no separate “core” crate; the client crate’s codec doubles as the shared foundation for both binaries.

Structs§

AuthRequest
One CONNECT awaiting an allow/deny decision.
BrokerTlsConfig
TLS configuration for MqttBrokerConfig::tls. All certificate/key material is PEM-encoded bytes (not file paths), matching mqtt_client::TlsOptions so this works identically across every language binding without assuming a filesystem layout.
EnhancedAuthStep
What the broker should do after one authentication round — a record (outcome + payload) rather than an enum-with-data, because several binding generators mishandle callbacks that return data-carrying enums.
MqttBroker
A running (or not-yet-started) MQTT broker instance, speaking both MQTT 3.1.1 and MQTT 5.0 — the protocol version is negotiated independently per connection from each client’s CONNECT packet.
MqttBrokerConfig
Configuration for an crate::broker::MqttBroker.

Enums§

BrokerEvent
A broker event, as returned by the pull-style MqttBroker::next_event (the polling twin of MqttBrokerEventListener).
EnhancedAuthOutcome
The verdict of one round of an MQTT 5.0 enhanced authentication exchange.
MqttBrokerError
Errors produced while starting or stopping an crate::MqttBroker.
QoS
MQTT Quality of Service level, as used in the broker’s own API (MqttBrokerConfig::max_qos, MqttBrokerEventListener, crate::BrokerEvent).

Constants§

DEFAULT_MAX_OUTBOUND_QUEUE
Default number of encoded packets that may be queued for one client’s socket before further deliveries to it are dropped (see MqttBrokerConfig::max_outbound_queue).
DEFAULT_MAX_PACKET_SIZE
Default cap on a single inbound packet (fixed header + body): 1 MiB. An unauthenticated peer can announce any size up to the protocol’s ~256 MiB maximum; without a cap each connection could force that much buffering.

Traits§

MqttAuthProvider
Pluggable authentication, evaluated once per CONNECT.
MqttBrokerEventListener
Broker-side view of a delivered/observed event, for monitoring and logging from foreign code.
MqttEnhancedAuthProvider
Pluggable MQTT 5.0 enhanced authentication (SCRAM, Kerberos, OAuth, …): a multi-round challenge/response evaluated during CONNECT, before the session is attached. A CONNECT naming an Authentication Method is refused unless a provider is registered.

Type Aliases§

MqttBrokerResult
Convenience alias for broker lifecycle operations.