Re:Reading and Writing Redis Protocol in Go
by laurent123456 on Monday May 19, 2014 @02:34PM
(#7768991)
I wonder why "\r\n" and not just "\n" is the string separator in RESP. I get that it needs to be human readable but \n should be enough to make it readable in any text viewer. Or is there something more to it?
[ Parent
| on HN ]
Re:Reading and Writing Redis Protocol in Go
by ominous_prime on Monday May 19, 2014 @03:07PM
(#7769171)
Probably only because CRLF is sort of the network line ending standard, used in many common protocols like http, imap, smtp, etc.
I was wondering the same thing. Perhaps "\r\n" is more friendly to Windows or Telnet users?
I wonder why errors and simple strings aren't just length-delimited as well. What do you gain by having both methods in one protocol?
I think human readability was something antirez really wanted, and having explicit line delimeters would make it easy to visually parse in a telnet session or building/debugging a client.
It's similar to HTTP chunked transfer encoding :
http://en.wikipedia.org/wiki/Chunked_transfer_encoding
And why did they choose these prefix chars ($, *, +, -) ?