Expand description
MQTT-SN packet builder.
Provides a fluent API for constructing MQTT-SN v1.2 packets.
§Examples
use stackforge_core::layer::mqttsn::builder::MqttSnBuilder;
// Simple PINGRESP
let pkt = MqttSnBuilder::pingresp().build();
assert_eq!(pkt, b"\x02\x17");
// CONNECT with client ID
let pkt = MqttSnBuilder::connect()
.cleansess(true)
.duration(30)
.client_id(b"test")
.build();
assert_eq!(&pkt[0..2], &[0x0a, 0x04]); // length=10, type=CONNECTStructs§
- Mqtt
SnBuilder - Builder for MQTT-SN packets.