Support a command delimiter
brunchboy opened this issue · 3 comments
It turns out that if commands get written close enough after one another on Carabiner’s socket, they get read as a single message, which causes parse errors like:
Failed to parse bpm: 127.4239501953125beat-at-time 355485494024 4.0
So I guess we need something to separate commands. To do this in a backwards compatible way, don’t require them, but allow them (and split on them). Probably newline? And add a new command that Beat Link Trigger can use to test if this is allowed before using it?
It turns out there is no need to add a new command to check whether it is safe to send trailing newlines, because they are safe to send even in older versions of Carabiner. It just doesn’t know to split the commands, so everything after the newline is ignored. Because of this, some way of checking the Carabiner version is probably a good idea. Then BLT can warn users if they should upgrade. A version command?
We also do need to put newlines at the end of our responses, for the same reason: if two or more get bundled into the same TCP message, clients need to be able to separate them.
All right, version 1.1.0 handles this, I will try to put together a new release soon.