jensstigaard / node-vmix

Node.js vMix utility to easily send commands and receive info such as xml data or real time tally from a vMix instance
MIT License
25 stars 7 forks source link

Fix processing of chunked messages #23

Closed ianshade closed 3 months ago

ianshade commented 8 months ago

I discovered a bug that was causing some received XML payloads to fail to parse when using ConnectionTCP. When I added debug logging, it turned out that the payload included some unrelated messages. Usually when it started happening, it would happen a lot. I'm assuming this is because single-line messages chunked in transit weren't handled correctly.

In this PR I changed how the messages are processed in ConnectionTCP, in order to make sure that only complete lines are processed further. Additionally, I changed rm -ifr to a more cross-platform rimraf in the clean script. In order to assert the functionality works as expected I wrote a few tests cases, however I used jest, which I'm more familiar with than mocha. I'll exclude this change from the PR if you prefer to stick to mocha.

jensstigaard commented 8 months ago

Hi Krzysztof

I like your changes, especially on tests and rimraf, and simplification in module code. I need to perform some manual tests, especially to check if your pr supports multiline text content in title fields, as I see this as a possible pitfall. If it passes my tests, I will of course merge.

ianshade commented 7 months ago

Hi! Did you get any chance to test the fix? I have a node-vmix build that includes the fix running 24/7 for some time now and my issue appears to be solved.

jensstigaard commented 3 months ago

@ianshade I can confirm that I have now accepted the pull request into the main branch, and pushed the changes to the npm registry as version 1.7.0. Sorry for the delay.