Help with IFC API v1 using Node.js

Hello everyone. I’m relatively new to Node.js and trying to write my own script for IFC API v1 using help from the repositories by @nicolas @nicolas, @KaiM and @likeablegeek . On sending the Airplane.GetState command, IF sends back two buffer arrays.

On converting the response to string, I notice that the first buffer array only has some random characters and no valuable data.

Due to this, I am unable to parse the response string.

Can someone explain what’s the use of the first buf array and help me out with parsing only the 2nd array containing actual data.
Any help is highly appreciated. Thank you.

It’s been a while since I used v1, so this’ll be more of a guess than an answer, but maybe It’ll be of some help.

How are you converting the first response to a string? Have you tried decoding it to JSON instead?

I am using JSON.parse(response.toString()) which is working on the initial data received from the udp broadcast but not working with the tcp clientSocket.

What about decoding it as an integer? (Or 32-bit integer, if normal integer doesn’t work… I’m not sure what node uses).