From 52913a1d55752993c6af72900cd1fbf43d6287ee Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 12 Oct 2013 11:12:47 -0400 Subject: [PATCH] Document the socketprotocol design --- doc/SocketProtocol.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 doc/SocketProtocol.txt diff --git a/doc/SocketProtocol.txt b/doc/SocketProtocol.txt new file mode 100644 index 00000000..d5582b68 --- /dev/null +++ b/doc/SocketProtocol.txt @@ -0,0 +1,22 @@ +The socket protocol is intended for high performance at the expense of a +non-standardized approach. The thinking is that with http so well supported, +the socket protocol is empowered to do whatever is needed. + +All data across the wire is TLV values. + +(since a single character is an exceedingly common case, have a single byte TLV +for those occasions) +Single byte TL (msb: 0): +Type=0 +Length=TL & 0b01111111 +Types: +0: text string + +(all other data has a 4 byte TLV for now) +Four byte TLs: (msb: 0b10) +Type=TL & 0b00111111000000000000000000000000 >> 24: +Length= TL & 0b111111111111111111111111 +0: text string +1: json data + +(msb: 0b11 is reserved), probably never to be needed