2019-07-01, 01:24 PM
(2019-07-01, 09:08 AM)tkurki Wrote: I'd be surprised if putting the whole delta on a single line would not work given that I am one of the primary authors of the server and know how things work underneath the hood. If you know better feel free to ignore my advice.And after that authoritative answer I'd be surprised if that wasn't the solution :-). Thank you, much appreciated.
The issue here is that a TCP stream is just a stream of bytes, there is no concept of a message in TCP. The receiver either needs to parse the input on the fly, balancing parentheses and breaking the input to delta messages, or we can choose a message delimiter. We have chosen newline as the delimiter, making the receiver much simpler, it just splits the input to messages by lines.
Once the input is split to individual messages newlines and whitespace no longer matter, each message is parsed as a JSON document. Documentation is formatted for easy reading and reflects this. Playground parses a single message as JSON. If you paste more than one message to Playground it will complain about invalid JSON - it is trying to handle just a single message, not the contents of a stream.
If you start the server in demo mode with sample data playback and netcat to port 8375 you will see deltas, one per line. This should be your reference - this is what the Signal K tcp input handles.
And just for everyone else ... It works. No newlines in a delta or full message.