Module decoder

Source

Functions§

decode_packet
Decode a packet with string data from a UTF-8 string. Each packet has a packet type (Open, Close, Message…) and a data section. decode_packet assumes the packet’s data is a string.
decode_payload
Decode a string-encoded payload containing multiple packets. Returns a Vec of parsed Packets, with the appropriate PacketData type for each packet if successful. In an encoded payload, each packet is denoted with its length and its data type; either binary or string. This function returns string packet data as is, and parses binary packets from base64 to a byte array.