subscribe
ModuleUndocumented.
Contents
use utopia_mqtt::packet::subscribe::Filter;Rust
pub struct FilterOne topic filter of a SUBSCRIBE and the QoS asked for it.
use utopia_mqtt::packet::subscribe::Suback;Rust
pub struct SubackA SUBACK being built: one code per filter, in the SUBSCRIBE's order.
Rust
use utopia_mqtt::packet::Suback;
let mut suback = Suback::new();
suback.grant(1).deny(Suback::DENIED);
assert_eq!(suback.codes(), [1, 0x80]);use utopia_mqtt::packet::subscribe::Subscribe;Rust
pub struct SubscribeA SUBSCRIBE: topic filters a client asks to receive.
Rust
use utopia_mqtt::packet::{Filter, Packet, Subscribe};
use utopia_mqtt::spec::v5;
let bytes = v5::subscribe(1, &[b"sensors/+/temp"], 1, None)?;
let subscribe = Subscribe::decode(Packet::parse(&bytes)?.body, 5)?;
assert_eq!(subscribe.packet_id, 1);
assert_eq!(subscribe.filters, [Filter { topic: b"sensors/+/temp".to_vec(), qos: 1 }]);