Expand description
Using mqttest
as a crate to unittest your client :
- Start the tokio runtime (and optionally a logger).
- Create a
Conf
struct with the desired behavior for your test. - Get an
Mqttest
struct by start()ing it. - Connect your client to the server port.
- Wait for your client(s) and/or the server to stop.
- Assert the
Vec<
ConnInfo>
results.
You can find practical examples in the test.rs
file.
Structs§
- Conf
- Specify server behavior.
- Conn
Info - Statistics and packet dumps collected about one connection
- Dump
Connack - Parsed MQTT connack packet.
- Dump
Meta - Dump
Payload - Dump
Publish - Parsed MQTT publish packet.
- Dump
Suback - Parsed MQTT suback packet.
- Dump
Subscribe - Parsed MQTT subscribe packet.
- Dump
Subscribe Topic - Dump
Unsubscribe - Parsed MQTT unsubscribe packet.
- Mqttest
- Handle to a running server.
- OptMs
Duration - Convenience type to save on typing an
Option<Duration>
.
Enums§
- Dump
Mqtt - Parsed MQTT packet.
- DumpQos
- Parsed QoS.
- Dump
QosId - Parsed QoS+PacketIdentifier.
- Dump
Subackcode