Open elegaanz opened 4 years ago
I have absolutely no idea of the different "messages" needed, or where is the limit between what the clients and the server handle.
Regarding the packet framing stuff, a Packet
enum with serde
+bincode
might be a good and fast idea if we're going with raw TCP and don't care with debug-ability and self-descriptiveness. It will make retro/forward compatibility harder though, so JSON or RON could work too.
Quick summary of what we would need:
So, in summary:
Also, maybe each event should be acknowledged, to make sure all client are in sync? maYbe wE cOuLD uSe a BLoCkhAiN AnD A ConSeNSuS AlgOritHM lIKE RAfT???!! More seriously, if we have a single TCP connection for each event we send, this acknowledgement would be in TCP directly, but this seems to be a poor design to close and re-open a connection every few seconds (and it means NAT traversal or something I guess, because we are sending a request from the server to the client, so definitely: NO). Also, I don't know if TCP can be bidirectional? Like once the client sent something, can it send something else even if the server started responding in the meantime?
Ideally, there should be some kind of encryption. TLS might the be the simplest solution for that.
We need to define a network protocol and implement it.
cc @edgarogh