secretsauceai / voice-assistant-protocol

A bus for voice assistants, including benchmarks.
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

TCP or UDP? #14

Open sheosi opened 2 years ago

sheosi commented 2 years ago

CoAP can work over both TCP and UDP, which one to choose?

skewballfox commented 2 years ago

Honestly, for this type of application where ordering matters quite a bit, if we can, we should go with TCP. UDP is faster because it doesn't use acks and also because it doesn't worry about ordering of messages.

Another option is to use TCP by default and UDP if we run into a scenario where TCP isn't an option due to resource constraints. As I mentioned in another issue, a server can have multiple listeners.

sheosi commented 2 years ago

I didn't think about reordering, but you are a 100% right. If a skill sends "hi" and "my name is..." they should arrive in the correct order. Now, in reality this shouldnt happen much since generally a skill wont send to the same client twice in a row, but since it might happen (specially with progressive responses that are resolved too fast) better be prepared.