monomux icon indicating copy to clipboard operation
monomux copied to clipboard

Version the communication protocol and prevent connection when client and server had breaking comms changes

Open whisperity opened this issue 1 year ago • 0 comments

A lot of currently pending issues (#2, #5, #12, #14) will require changes to the communication protocol which would be backwards-incompatible. This would be the perfect moment to introduce, into the comms, a stable way of the server and the client discussing the versions of the protocol used. There should be a soft warning in case the server and the client are not the same binaries (string comparing Version::whatever), and a hard error preventing communication if the API had breaking changes.

The API version should be versioned in a single global location in the code. A single unsigned number is enough... and we will hopefully keep updating it each time the communication layer changes.

An alternative solution would be creating a hash, at compile-time, from the most important and critical parts of the communication library. However, that would be too brittle and sensitive to refactoring changes in the source code itself that are irrelevant to the actual API at hand.

whisperity avatar Dec 30 '22 18:12 whisperity