[][src]Crate rumq_client

Structs

Connack
Connect
LastWill
MqttEventLoop
MqttOptions

Mqtt options

MqttState

MqttState saves the state of the mqtt connection. Methods will just modify the state of the object without doing any network operations Methods returns so that n/w methods or n/w eventloop can operate directly. This abstracts the functionality better so that it's easy to switch between synchronous code, tokio (or) async/await

PacketIdentifier
Publish
Suback
Subscribe
SubscribeTopic
Unsubscribe

Enums

ConnectReturnCode
Error
EventLoopError
Notification

Incoming notifications from the broker

Packet
PacketType
Protocol
QoS
SecurityOptions

Client authentication option for mqtt connect packet

SubscribeReturnCodes

Traits

AsyncMqttRead
AsyncMqttWrite
MqttRead
MqttWrite

Functions

connack
connect
connect_return
empty_subscribe
eventloop

Returns an object which encompasses state of the connection. Use this to create an Stream with stream() method and poll it with tokio The choice of separating MqttEventLoop and stream methods is to get access to the internal state and mqtt options after the work with the Stream is done or stopped. This is useful in scenarios like shutdown where the current state should be persisted or during reconnection when the state from last disconnection should be resumend. For a similar reason, requests are also initialized as part of this method to reuse same request stream while retrying after the previous Stream from stream() method ends

has_wildcards
matches

checks if topic matches a filter. topic and filter validation isn't done here. NOTE: 'topic' is a misnomer in the arg. this can also be used to match 2 wild subscriptions NOTE: make sure a topic is validated during a publish and filter is validated during a subscribe

packet_type
publish
qos

7 3 0 +--------------------------+--------------------------+ byte 1 | MQTT Control Packet Type | Flags for each type | +--------------------------+--------------------------+ | Remaining Bytes Len (1 - 4 bytes) | +-----------------------------------------------------+

suback
subscribe
valid_filter

checks if the filter is valid https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106

valid_topic

checks if a topic is valid