Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary object to Base64 support #189

Open
ecorm opened this issue Mar 18, 2016 · 5 comments
Open

Binary object to Base64 support #189

ecorm opened this issue Mar 18, 2016 · 5 comments

Comments

@ecorm
Copy link

ecorm commented Mar 18, 2016

Does autobahn-js support conversion of binary objects to Base64, as per section 14 of the WAMP spec?

If a Base64 string were manually constructed with a leading '\0', and passed as an RPC argument, would it break Autobahn|JS?

@oberstet oberstet added the bug label Mar 19, 2016
@oberstet
Copy link
Contributor

This isn't implemented yet. But since the refactoring of serializers, this could now be done at one place:

https://github.com/crossbario/autobahn-js/blob/master/package/lib/serializer.js#L22

JSON.stringify and JSON.parse don't know about the WAMP binary conversion thing, so that code needs to be expanded:

  • serialize needs to walk over the obj looking for binaries and replace those with the string encoding as per WAMP spec before putting the obj into JSON.serialize
  • unserialize needs to walk over the unserialized payload coming out of JSON.parse after unserialization, and replace strings that start with \ 0 with a decoded binary

@oberstet
Copy link
Contributor

In fact, we've just recently implemented this in AutobahnPython and Crossbar.io. Which finally allows to fix this here too, since we can now test the feature.

@oberstet oberstet added the core label Apr 20, 2017
@chrisbarber
Copy link

Would it make sense to be able to configure base64 as a serializer for the REST bridge? This seems like it would be handy because unless I am missing something, a method written to return some binary can currently not be called via REST bridge, only over websocket.

@oberstet
Copy link
Contributor

@chrisbarber yes, that would make sense: crossbario/crossbar#1079

When this is done, then AB JS needs bits too.

But the issue here is to add support for transparent binaries over JSON in AB JS over regular transports (WebSocket/RawSocket) ..

@oberstet
Copy link
Contributor

there now is CI test coverage for binary payloads via https://github.com/crossbario/autobahn-js/blob/master/test/test_binary.js

to activate the tests for json, uncomment this:

// exports.testBinaryJSON = binary.testBinaryJSON;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants