Send binary file with WAMP

266 views
Skip to first unread message

Travis Painter

unread,
Aug 17, 2014, 10:41:38 PM8/17/14
to autob...@googlegroups.com
I want to send a binary file using WAMP. Per this stackoverflow question [does-autobahnjs-support-binary-messages], it appears that it might be possible in WAMPv2. Is there a convenient way to do this? The file would be sent from python to JS.

I am currently doing this by base64 encoding the file, sending, and then decoding on the client-side. At the time I first I tried to directly send the binary file, I had an error that it wasn't able to be json encoded. This made me move on with the base64 method.

Do I need to invoke 'msgpack' in an option somewhere?

Thanks - Travis 

Tobias Oberstein

unread,
Aug 18, 2014, 3:52:38 PM8/18/14
to autob...@googlegroups.com
Hi Travis,

Am 18.08.2014 04:41, schrieb Travis Painter:
> I want to send a binary file using WAMP. Per this stackoverflow question
> [does-autobahnjs-support-binary-messages]
> <[http://stackoverflow.com/questions/17643777/does-autobahnjs-support-binary-messages]>,
> it appears that it might be possible in WAMPv2. Is there a convenient
> way to do this? The file would be sent from python to JS.

Yes, WAMP2 supports MsgPack as serialization format, which is able to
transport binary data without base64 (or other) encoding.

AutobahnPython has full support for MsgPack. AutobahnJS not yet (it's on
the "todo" list)

But

https://github.com/KSDaemon/wampy.js

supports both JSON and MsgPack.

>
> I am currently doing this by base64 encoding the file, sending, and then
> decoding on the client-side. At the time I first I tried to directly
> send the binary file, I had an error that it wasn't able to be json
> encoded. This made me move on with the base64 method.
>
> Do I need to invoke 'msgpack' in an option somewhere?

wampy can talk WAMP-over-WebSocket with MsgPack with AutobahnPython.

I guess there is an option to make wampy announce MsgPack when
connecting. You might ask Konstantin -- wampy developer and a very nice
and helpful guy ..

Cheers,
/Tobias

>
> Thanks - Travis
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/a7f3dae3-41c6-4fa4-be36-f4fd82f36695%40googlegroups.com
> <https://groups.google.com/d/msgid/autobahnws/a7f3dae3-41c6-4fa4-be36-f4fd82f36695%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages