node-stomp icon indicating copy to clipboard operation
node-stomp copied to clipboard

Receiving partial frames

Open dhm116 opened this issue 13 years ago • 1 comments

I will fairly frequently receive only partial frames (headers are in-tact, body is not) that obviously causes issues when deserializing the body.

   debug - websocket writing 5:::{"name":"HealthVmf","args":[{"content":{"software_version":"1","event_time":"2011-11-18T11:11:14","usmc_reg_number":"750007","reporting_rules":{},"niin":"","asset_predictions":[{"confidence":0.11886785150782209,"type":"health","prediction_value":24,"value":0.8690623483033539,"units_of_measure":"hours"},{"confidence":0.004299265411375486,"type":"health","prediction_value":48,"value":0.06361559861095223,"units_of_measure":"hours"},{"confidence":0.11785012912386283,"type":"health","prediction_value":72,"value":0.3375146161848036,"units_of_measure":"hours"},{"confidence":0.9456682047928826,"type":"capability","prediction_value":24,"value":0.16703802851403682,"units_of_measure":"hours"},{"confidence":0.06421372021030214,"type":"capability","prediction_value":48,"value":0.7132979341161454,"units_of_measure":"hours"},{"confidence":0.7637086198212889,"type":"capability","prediction_value":72,"value":0.24131532630889097,"units_of_measure":"hours"}],"subsystem_predictions":[],"null":"4ec683ac6b3d64131000004a","longitude":-91.98810313762532,"asset_ratings":[{"confidence":0.37463542561153107,"type":"health","value":0.14276005105890377},{"confidence":0.7280031347834909,"type":"status","value":0.5775468815260397},{"confidence":0.9904095475559633,"type":"capability","value":0.9380546816751684}],"iuid":"750007","latitude":61.10325997007084,"subsystem_ratings":[],"urn":"1","reporting_interval_minutes":54,"free_text":""}}]}
Error deserializing incoming data: SyntaxError: Unexpected token ILLEGAL
Original message: MESSAGE
message-id:ID:phm-dst-53194-1321478973416-2:174:-1:1:26
destination:/queue/websocket
timestamp:1321632678492
expires:0
priority:4

{"content": {"software_vers

   debug - websocket writing 5:::{"name":"HealthVmf","args":[{"content":{"software_version":"1","event_time":"2011-11-18T11:11:14","usmc_reg_number":"460120","reporting_rules":{},"niin":"","asset_predictions":[{"confidence":0.14583134511781315,"type":"health","prediction_value":24,"value":0.8374303824883288,"units_of_measure":"hours"},{"confidence":0.2235537688241921,"type":"health","prediction_value":48,"value":0.9900469231042737,"units_of_measure":"hours"},{"confidence":0.8385740996737078,"type":"health","prediction_value":72,"value":0.7004248233157432,"units_of_measure":"hours"},{"confidence":0.5594018113384451,"type":"capability","prediction_value":24,"value":0.6876143514882849,"units_of_measure":"hours"},{"confidence":0.8870432943790096,"type":"capability","prediction_value":48,"value":0.44314667511221295,"units_of_measure":"hours"},{"confidence":0.3371514399311314,"type":"capability","prediction_value":72,"value":0.4646472118803988,"units_of_measure":"hours"}],"subsystem_predictions":[],"null":"4ec683a46b3d64131000003e","longitude":99.44465273223716,"asset_ratings":[{"confidence":0.5969260411835807,"type":"health","value":0.38639053600759976},{"confidence":0.37693504788594645,"type":"status","value":0.8551969563563105},{"confidence":0.36904633564017475,"type":"capability","value":0.5075242386313786}],"iuid":"460120","latitude":83.47859480455003,"subsystem_ratings":[],"urn":"1","reporting_interval_minutes":17,"free_text":""}}]}

I have verified that the original data being published is a complete frame, so I'm suspecting there's just something strange going on with the node-stomp library. Are there speed limitations that I'm exceeding?

dhm116 avatar Nov 18 '11 16:11 dhm116

So, looking over the code, I think the issue is related to how frames are detected and split apart, which appears to be incorrect. A buffer is need, however it looks like this idea was started but never implemented.

dhm116 avatar Nov 18 '11 19:11 dhm116