Parses variable byte integer in the stream and returns the length
and number of bytes that make it. Used for remaining length calculation
as well as for calculating property lengths
Parses fixed header
解析包。数据截断、丢弃等逻辑:done
Reads a series of bytes with a length from a byte stream
Reads a string from bytes stream
After collecting enough bytes to frame a packet (packet’s frame())
, It’s possible that content itself in the stream is wrong. Like expected
packet id or qos not being present. In cases where read_mqtt_string or
read_mqtt_bytes exhausted remaining length but packet framing expects to
parse qos next, these pre checks will prevent bytes crashes
Serializes bytes to stream (including length)
Serializes a string to stream
Writes remaining length to stream and returns number of bytes for remaining length