Websocket invalid JSON

I've identified an issue where on one of my printers the web interface simply dies.
Debugging the javascript reveals that the websocket connection has some invalid JSON in it which is causing the error.

As part of the temperature list, it sends this:
{
"data": {
"O": 0.0000000000000000,
"S": 0.0000000000000000,
"T": inf,
"id": -1,
"t": 1495243321447
},
"event": "temp",
"printer": "Delta"
}
The "T":inf, bit is what triggers the problem.

This particular temperature data point is coming from a Smoothieware board.
The server should probably send 0 or something more sensible instead of infinity which isn't allowed by the JSON spec.

Comments

  • Do you mean smoothieware does not always send valid number as temperature? What does it send if you can say? maybe "inf" ?
  • Just to be on the safe side I have added a inf/nan test on temperatures for next release.
Sign In or Register to comment.