Module util

Module util 

Source
Expand description

§MQTT Serialization Utilities

This module provides helper functions for reading and writing MQTT-specific data types from and to byte buffers, such as variable-byte integers and length-prefixed strings.

Functions§

read_utf8_string
Reads a UTF-8 encoded string (prefixed with a 2-byte length) from the buffer.
read_variable_byte_integer
Reads a variable-byte integer from the buffer, advancing the cursor.
write_utf8_string
Writes a UTF-8 encoded string (prefixed with a 2-byte length) to the buffer.
write_variable_byte_integer
Writes a variable-byte integer to the buffer, advancing the cursor.
write_variable_byte_integer_len
A simplified version of write_variable_byte_integer for external use that returns the byte count.