Rust

connect

Module

Undocumented.

Contents

use utopia_mqtt::packet::connect::Connect;
Rust
pub struct Connect

A CONNECT: what a client asks for when it opens a session.

Rust
use utopia_mqtt::packet::{Connect, Packet};
use utopia_mqtt::spec::v3;

let bytes = v3::connect(b"device-tv", 60, true, b"user", b"secret");
let connect = Connect::decode(Packet::parse(&bytes)?.body)?;
assert_eq!(connect.client_id, b"device-tv");
assert_eq!(connect.password.as_deref(), Some(&b"secret"[..]));
use utopia_mqtt::packet::connect::Will;
Rust
pub struct Will

The Will of a CONNECT: the message the broker publishes for a client that goes away without a DISCONNECT. Its 5.0 properties are skipped.