[Twisted-Python] AMP WebSockets bridging
tom.sheffler at gmail.com
Sat Jun 16 11:16:03 EDT 2012
> On Jun 15, 2012, at 10:13 AM, Laurens Van Houtven wrote:
> > Hi,
> > I'm trying to get browsers to communicate with an AMP API.
> This is also what <https://launchpad.net/frack> is doing. I hope that it
> becomes a common enough practice that there's a library for it :).
> > The issue is that while AMP is inherently a binary protocol, WebSockets
> transfer text (well, that's a lie: there's a binary version, but it's even
> less widely supported than WebSockets themselves -- and SockJS doesn't
> support it at all, although it's on the roadmap). So, I need an
> alternative, preferably 7-bit, serialization for AMP boxes.
> Did you immediately discard the obvious solution of "base64 everything"? :)
I had success simply base64'ing binary data. And I believe encoding that
is safe for binary data, but I may be wrong.
data = binascii.b2a_base64(bindata).strip()
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python