Improve the connection message protocol
The connection protocol in decentralise2 mostly assumes that there are finite message types, which hinders its extensibility somewhat. It also assumes that all messages are represented as lists where the first element specifies the type, which is not an optimal representation.
The protocol should be updated to:
- allow
write-message
to be able to send arbitrary message types, by either- allow users to tell decentralise2 about the existence of their types and how to parse them, or
- make
write-message
a generic function that actually send messages, and have "verb" functions likewrite-ok
call that generic function (inverting the current relationship), and then
- inform
message-case
how to destructure user-defined message types.