Skip to main content

Module transmit

Module transmit 

Expand description

Encodes pending session state onto the wire for outbound transmission.

Client::poll_transmit is the only place where outgoing SUBSCRIBE, UNSUBSCRIBE, PUBLISH, and PUBREL packets are produced. It owns topic-alias assignment (via a caller-supplied OutboundAliasTable), Maximum Packet Size enforcement, and encoding into a PacketWriter, so an I/O driver only has to move the resulting bytes.

SUBSCRIBE/UNSUBSCRIBE payloads are encoded straight from the session’s pending-filter iterators in two passes (measure, then write). The drain does not allocate for any session backend.

Structs§

SubscribeGroup 🔒
One pending SUBSCRIBE group, encoded straight from the session’s iterator without an intermediate buffer.
UnsubscribeGroup 🔒
One pending UNSUBSCRIBE group. See SubscribeGroup.

Enums§

AliasDecision
What to do with the topic alias for an outgoing PUBLISH (§3.3.2.3.4).
DrainError
Error returned by Client::poll_transmit. The session keeps the packets not yet written for the next call.
PublishFailure 🔒
Why encode_publish did not write a PUBLISH.
TransmitError
Error returned by Client::transmit_qos0.
TransmitEvent
An outcome of Client::poll_transmit the caller must act on, reported per packet identifier so the driver can resolve the user-facing future.

Traits§

OutboundAliasTable
Per-connection outbound topic-alias assignment.

Functions§

encode_publish 🔒
Resolves the topic alias for a publish, enforces the server’s limits, and encodes it into out. This is the only place where an outgoing PUBLISH is built, shared by the session drain and the QoS 0 path. A New alias is released again if the packet is not written, so a dropped publish does not leave a phantom mapping.
write_packet 🔒
Writes packet unless it exceeds the server’s Maximum Packet Size.