-
Notifications
You must be signed in to change notification settings - Fork 0
compression protocol
While full information in every CommandData is neat for debbugging, it isn't so great when it comes to data limits.
That is where the command compression comes in, it makes a few changes to the data to make it smaler with the help of the messagepack design:
- sender and receiver can be replaced with
nullif they are the the sending party - slugs are mapped into numbers
After startup and connection completes the client makes a list of all commands, sorted alpabetically, and sends a hash to the server which searches if the already exists, if not it creates it taking into account how often a given command was used in the past. It then sends back the index for every command as another list in the same order. Now the commands are synced and are replaced with the number in the future.
The commands numbers are given out most used to less used because messagepack uses single byte representation for the first 127 ints.