Convert text to json

Absolutely. But now you have at least learned that - even in your fast production system - there might be a keepalive chunk arriving from time to time.

But now you know how the protocol works, and you have a code snippet that should be enough to get you started. You need to run the code on your production system, and debug it until you are sure it work fine for a sequence of xmls. Perhaps you need to do a few small tweaks. Based on the stuff you are busy with, I assume you have enough technical skills to do that. In case you have no idea how to debug a function node, I wrote a short tutorial some time ago.