Looking to stream telemetry data in JSON format from a websocket to a browser using javascript. The websocket is set up on server X.X.X.X with native c and the websocketd wrapper on port 8080. A client (IP: Y.Y.Y.Y) should connect to the same server via https on port 80 () and receive javascript code instructing it to fetch live data from the websocket (ws://X.X.X.X:8080) and update values on the webpage accordingly.
An example of the data structure:
{
"name of system": {
"RSSI": {
"rssi": "0",
"adc1": "0.00",
"adc2": "0.00",
"rxBatt": "0.00",
"swr": "0"
},
"ASS": {
"airspeed": "0.00"
}
}
}
{...}
and more...
This data will be sent in a continuous loop, every 500ms, without any spaces or line breaks.
Attempted parsing this with JSON.parse() but encountering errors like: "Uncaught SyntaxError: Unexpected token *" or "Unexpected token {". Is this due to incorrect JSON implementation, even after multiple checks?
So my question is: Can JSON.parse handle livestreaming? If not, are there alternative libraries for this task, or should I consider a completely different approach?
Thank you