Skip to main content

ruststream_rumqttc/
lib.rs

1//! MQTT 5 broker implementation for `RustStream`, built on `rumqttc`.
2//!
3//! Handlers, routers, codecs, and middleware come from the framework; this crate supplies
4//! the transport over [`rumqttc`](https://docs.rs/rumqttc), targeting MQTT 5 because two
5//! things the framework relies on exist only there: user properties (headers travel natively
6//! instead of through an invented envelope) and shared subscriptions (competing consumers
7//! are expressible at all).
8//!
9//! - The crate owns a connection task that drives the client's single event loop,
10//!   demultiplexes packets to per-subscription streams by topic-filter matching, reconnects
11//!   with backoff, and resubscribes when the broker reports the session gone - all without
12//!   ever stalling keep-alive traffic.
13//! - Acknowledgement follows the quality of service: `QoS` 1/2 acknowledge through the
14//!   protocol under manual control; `QoS` 0 reports
15//!   [`AckError::Unsupported`](ruststream::AckError::Unsupported) rather than pretending, as
16//!   does `nack(requeue = true)` - MQTT has no negative acknowledgement, and unacked
17//!   messages redeliver when a persistent session resumes.
18//! - Retained messages, last will, session persistence, and TLS with client certificates are
19//!   configuration on the broker and the publish policy.
20
21#![forbid(unsafe_code)]
22
23mod broker;
24mod conn;
25mod error;
26mod filter;
27mod message;
28mod publisher;
29mod subscriber;
30#[cfg(feature = "testing")]
31pub mod testing;
32
33pub use broker::{ConnectedMqttBroker, MqttBroker};
34pub use error::MqttError;
35pub use filter::{MqttTopic, Qos};
36pub use message::MqttMessage;
37pub use publisher::{MqttPublish, MqttPublisher};
38pub use subscriber::MqttSubscriber;