<br><br>On Friday, June 15, 2012, Glyph  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On Jun 15, 2012, at 10:13 AM, Laurens Van Houtven wrote:<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;m trying to get browsers to communicate with an AMP API.<br>
<br>
This is also what &lt;<a href="https://launchpad.net/frack" target="_blank">https://launchpad.net/frack</a>&gt; is doing.  I hope that it becomes a common enough practice that there&#39;s a library for it :).</blockquote>
<div><br></div><div>See Allen&#39;s comment. It&#39;d certainly be great. Do you think that for old browsers (that is ie6 &amp; 7) it&#39;s acceptable to tell them to go install chrome frame? ( for Franck and hence twisteds future bug tracker). If the answer is yes, is that because it will take a while to switch, or would that also be true today?</div>
<div><br></div><div>Bear in mind that my users are a lot less technical and many are stuck on winxp because they&#39;re corporate machines...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

&gt; The issue is that while AMP is inherently a binary protocol, WebSockets transfer text (well, that&#39;s a lie: there&#39;s a binary version, but it&#39;s even less widely supported than WebSockets themselves -- and SockJS doesn&#39;t support it at all, although it&#39;s on the roadmap). So, I need an alternative, preferably 7-bit, serialization for AMP boxes.<br>

<br>
Did you immediately discard the obvious solution of &quot;base64 everything&quot;? :)</blockquote><div><br></div><div>Base64 does not fix the problem of encoding and decoding binary responses on the client side, only on the transport. Binary support (Blob and ArrayBuffer are those 2 essentially unsupported things. It may be feasible to build a Unicode amp representation, however meaningless some code points may then become (that&#39;s not a tab stop, it&#39;s a length specifier!!)<span></span></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
&gt; An issue I&#39;m running into is an AMP ListOf. With the above code, ListOf still gets translated to a string, and obviously I want it to be a list. When that ListOf has actual data in it, I get the binary representation.<br>

<br>
I would recommend implementing an entirely alternate serialization code path; specifically, one which adapts the existing AMP Argument objects to some new interface (&#39;.toJSON()&#39;), with a default adapter that uses the existing toString()/fromString(), and then specific adapters for those interfaces which need modification, like ListOf and Boolean.</blockquote>
<div><br></div><div>I&#39;m not sure I understand at which point that takes effect since apparently AMP.sendBox is too late?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
-glyph<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;Twisted-Python@twistedmatrix.com&#39;)">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote><br><br>-- <br>cheers<div>lvh</div><br>