Currently, I am successfully receiving messages from a Server via Websocket. The received messages are in the form of a Javascript Object, and my goal is to extract the necessary data from it and update the state of my React app accordingly.
Here is the code snippet I am currently using:
connection.onmessage = function (newMessage) {
if(newMessage.data == '{"msg":"ping"}' ){
connection.send('{"msg": "pong"}')
}
newMessage = JSON.parse(newMessage.data)
console.log(newMessage.fields)
}
After receiving the message, I am logging the 'fields' property of the parsed object.
To see the actual object that I am working with, you can visit this Javascript Object.
Specifically, I am interested in the Array located at args/0. How can I extract this array from the object?
Thank you for your help.