3 ms·
can anyone explain why the message format uses fancy control chars like <channel_name>!<message><newline_character> foo!hello, world why not json?
by stefs 17y ago
can anyone explain why the message format uses fancy control chars like
<channel_name>!<message><newline_character>
foo!hello, world
why not json?
{cname: "foo", msg: "hello, world"}
i mean, parsing fancy format may be a bit faster and needs less library code; and, of course, overhead. but from personal experience i know that fancy control chars mostly lead to perlish charsoup as soon as new features are implemented.
foo!hello, world##from_id:213/5|sendername:chad//validuntil{20100429105700}?debug=true&nlformat=CRLF
i guess, overhead; am i right?
- jazzychad 17y agoI don't consider ! to be a fancy control character. It's just simple. Outputing/requiring json adds extra complexity and restriction that isn't necessary. Although, nothing says you can't send the messages as json (which is, in fact, what I do in my applications!). Letting the message format be completely free-form means you can treat it however you like. The idea was to make it incredibly simple, and abstract enough (meaning no extra/unneeded logic baked in) so that it could be used in the widest set of applications. The application you build with it may well use json as its message format, but I saw no need to require a certain format. Here is an example of a message I'm using in the 4squrevision example: 4sq_checkins!{"iid":17295,"tid":13057779551,"location":"Maths Journey","sqlink":"http://4sq.com/cGG46G","user":"greeenpea","lat":null,"tstamp":"Thu Apr 29 08:20:33 +0000 2010","lng":null} Simple.