receive

open suspend override fun receive(): ByteArray

Reads one complete MQTT packet from the TCP stream.

  1. Read the fixed header byte (packet type + flags).

  2. Read the Variable Byte Integer remaining length (1–4 bytes).

  3. Read exactly remainingLength payload bytes.

  4. Return the reassembled packet as a single ByteArray.