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§
- Subscribe
Group 🔒 - One pending SUBSCRIBE group, encoded straight from the session’s iterator without an intermediate buffer.
- Unsubscribe
Group 🔒 - One pending UNSUBSCRIBE group. See
SubscribeGroup.
Enums§
- Alias
Decision - What to do with the topic alias for an outgoing PUBLISH (§3.3.2.3.4).
- Drain
Error - Error returned by
Client::poll_transmit. The session keeps the packets not yet written for the next call. - Publish
Failure 🔒 - Why
encode_publishdid not write a PUBLISH. - Transmit
Error - Error returned by
Client::transmit_qos0. - Transmit
Event - An outcome of
Client::poll_transmitthe caller must act on, reported per packet identifier so the driver can resolve the user-facing future.
Traits§
- Outbound
Alias Table - 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 theQoS0 path. ANewalias is released again if the packet is not written, so a dropped publish does not leave a phantom mapping. - write_
packet 🔒 - Writes
packetunless it exceeds the server’s Maximum Packet Size.