How to convert the tlv format data received by socket in WeChat Mini Programs into json data of JS?

for example, the data is received through Mini Program"s websocket. The binary array is

.
[0, 0, 0, 45, 0, 2, 0, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 2, 0, 8, 115, 117, 99, 99, 101, 101, 100, 0, 3, 0, 4, 0, 0, 0, 0, 4, 0, 7, 49, 48, 48, 48, 48, 48, 0]

the server says that the data is in tlv format. Ask the god who thinks no how to parse the data. Can the front end parse the data?

Mar.10,2021

answer your own questions and take the time to write an article about specific logic and methods.

first truncate the returned binary array according to the length of the fixed header defined by the server, and then convert it to String and Number, of JS according to the various data types (int, short, byte, string, etc.) defined in header, and then match the names of each interface from the fields specified in the parsed data. After matching to the specified interface, each field defined by the interface is processed sequentially from the remaining binary array according to the order of tag, length, and value

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf1328-31d40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf1328-31d40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?