Crate sage_mqtt[][src]

Expand description

sage_mqtt is a an encoding/decoding library for MQTT 5.0 protocol. The library consists in pivot types, such as UTF8String that can be written to and read from a stream as well as converted to standard Rust types.


encode/decode MQTT fundamental types

A set of default values for MQTT packets


The Auth packet is used for enhanced authentication upon connection. When a client connects to a server, it can initiates an authentication using the Authentication structure. Then the client and server exchange Auth packets until either the the client sends a Disconnect packet or the server respond with a Connack packet.

By default, Connect packets provide optional user_name and password fields which can be used to provide basic authentication. Enhanced authentication can be provided by using an Authentication structure which will initialize a challenge / response style authentication. Ii might imply the exchange of several Auth with reason code ContinueAuthentication until eventually one is send with either Success or any relevant error code and, in that case, close the connection. The authentication method which is used as an agreement on how authentication exchanges will perform. Authentication data can be sent at any moment according to this agreement. See the section 4.12 (Enhanced Authentication) of the MQTT 5 specifications for examples.

The Connack message is sent from the server to the client to acknowledge the connection request. This can be the direct response to a Connect message or the closing exchange of Connack packets.

The Connect control packet is used to open a session. It is the first Packet a client must send to a server once the connection is established. A Connect packet can only be sent once for each connection.

A Disconnect packet can be sent by the client or the server to gracefully disconnect.

A ping request message

A ping response message

A PubAck is the response for a Publish message with AtLeastOnce as quality of service.

The PubComp packet is sent during an ExactlyOnce quality of service publish.

The PubRec packet is sent during an ExactlyOnce quality of service publish.

The PubRel packet is sent during an ExactlyOnce quality of service publish.

The Publish packet is used to send an application message to a given topic.

The SubAck packet is sent by a server to confirm a Subscribe has been received and processed.

The subscribe packet is a request from the client to listen to one or more topics.

Options used to describe a specific subscription.

A topic name a broker or client publishes to

An UnSubAck is sent by the server to acknowledge an unsubscribe request.

An Unsubscribe packet is sent from the client to unsubsribe to a topic.

Due to the unstable nature of a connexion, the client can loose its connection to the server. This ungraceful disconnect can be notified to every other clients by specifying a Last Will message that is given upon connection. When a client ungracefully disconnect from a server (when the keep alive is reached), the server will publish the Last Will message to anyone subscribed to its topic.


The error type for Sage MQTT operations

The standard type to manipulate a AsyncRead/AsyncWrite-able MQTT packet. Each packet is an enum value with its own type.

Description the quality of service used in message publishing.

A ReasonCode is an identifier describing a response in any ackowledgement packet (such as Connack or SubAck)

This option specifies whether retained messages are sent when the subscription is established;

Type Definitions

String alias to represent a client identifier

Standard Result type for Sage MQTT