Hacker News new | ask | show | jobs
by imtringued 541 days ago
If you use JSON in an embedded capacity and you're stingy with your bytes, you can just send arrays as your main document.

There was this one MMO I played, where every packet was just a space separated string, with a fancy variable length number encoding that let them store two digits in a single character.

There is not much difference between

    walk <PlayerId> <x> <y>
    walk 5 100 300
and

    ['walk', '<PlayerId>', '<x>', '<y>']
    ['walk', 5, 100, 300]
in terms of bytes and parsing, this is trivial, but it is a standard JSON document and everyone knows JSON, which is a huge win on the developer side.