* Matthew Mondor [2011-11-06 18:43] writes:
Did the previous protocol also have such a 0x00 byte prefix? If so, it would be possible to use 0x01 this time and provide more backwards compatibility...
No. We used something like (format nil "~6,'0x" <length>) for the header so most of the time the first byte was (char-code #\0) which is 48.
If not, I could perhaps suggest that the byte in the future be used to hold a protocol version as well as flags (such as as you mentioned, for gzip-compressed, etc).
I think one bit should be a "streaming bit", with the intention that the payload should be concatenated to the next frame until the first frame with the streaming bit cleared comes along. That would allow messages of arbitrary length and also frames of fixed size (for easier buffering).
3 or 4 bits should probably be a "type code" for the payload. Type 0 would be "a s-exp in utf8". Type 1 probably "just plain bytes to be interpreted by a higher level". I'm not even sure that we need something else :-). Anyway, that would leave 6 or 13 other type codes for future use and 3-4 unused bits.
Helmut