A truly stripped down binary-protocol can be faster and leaner than JSON, but for web-work JSON is highly preferred.  Why?  Javascript has zero tools for handling binary data and PHP's binary support is all but non-existent.<div>
mochijson2 is a good library for converting between erlang terms and JSON.</div><div><br></div><div>JSON is more word-y and takes up more bandwidth, sure, but most people aren't uber-optimizing for 56k modems these days (exception: mobile.)</div>
<div>The ease of using JSON in Ruby + PHP + javascript + iOS + Android more than makes up for the wire overhead.   And it's easier to read tcpdump/pcaps, use existing tools like curl and read native traces/dumps.</div>
<div><br></div><div>If you're just using backend server-server, BERT is easier and protobufs is smaller/more efficient.</div><div><br></div><div>I use JSON on the front, BERT on the back with protobufs for talking to Riak.  I deprecated AMF and a custom binary protocol on the front due to the above reasons.</div>
<div><br></div><div>-mox<br><br><div class="gmail_quote">On Wed, Apr 11, 2012 at 9:20 AM, Heinz N. Gies <span dir="ltr"><<a href="mailto:heinz@licenser.net">heinz@licenser.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I was thinking about the same,<br>
after some testing I went to use JSON it was smaller then BERT+base64 for my cases without it I had problems with transmissions.<br>
<br>
Regards,<br>
Heinz<br>
--<br>
Heinz N. Gies<br>
<a href="mailto:heinz@licenser.net">heinz@licenser.net</a><br>
<a href="http://licenser.net" target="_blank">http://licenser.net</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Apr 10, 2012, at 04:26, ngocdaothanh wrote:<br>
<br>
> What is the best way to use BERT encoding (<a href="http://bert-rpc.org/" target="_blank">http://bert-rpc.org/</a>) with<br>
> WebSocket?<br>
><br>
> BERT is binary but WebSocket does not support binary at this moment.<br>
> Should I use base64 to encode BERT binary to normal string? Base64 has<br>
> 33% overhead (<a href="http://en.wikipedia.org/wiki/Base64" target="_blank">http://en.wikipedia.org/wiki/Base64</a>). How much space can<br>
> BERT save compared to JSON?<br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>