-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support multiple serializers #44
Comments
@om26er serializers are not negotiated in WAMP. Not sure if I will ever implement this. I will definitly accept a PR. If you need help with this, I could support you. |
Right, we essentially need to send a list of serializers that our client talks in the initial handshake. The only user-facing change would be the addition of an API that takes serializers as a list instead of the current single serializer. |
@om26er Could you get me more details on that? You want to extend the |
@konsultaner the supported serializers have to be provided during the websocket handshake, they are negotiated before WAMP session is estabilished. We need to change this code to take multiple serializers https://github.com/konsultaner/connectanum-dart/blob/master/lib/src/transport/websocket/websocket_transport_io.dart#L77 Once the connection is established the The preference is from left to right, the router will return the first serializer that it supports. |
@om26er |
@oberstet does crossbar support that too? What do you think about it? |
This page might be of interest https://medium.com/@lancers/websocket-api-sec-websocket-protocol-subprotocol-header-support-277e34164537 Also afaik, Crossbar has that behavior and so does all autobahn libraries |
And this line
would essentially look like
|
yes, that is true. however, WAMP transports may have negotiation - as does WebSocket for example. in code terms, both WAMP-WebSocket clients and servers maintain a list of serializers they support with WAMP-WebSocket clients, the client will send the list as WebSocket subprotocols: the WAMP-WebSocket server, that is the router, will select the first one from that list it supports RawSocket doesn't allow the client to provide a list for the server to choose from .. the client provides 1 serializer and the server must support that - otherwise it denies the client
the application can do that if it feels to. none of the autobahn libraries have that built in .. I think;) in any case, it's largely uneeded in my eyes, because:
|
writing above .. reminds me of "batched transports" ... which is a thing, and can bring quite some efficiencies. in particular on TLS. because there you want to shuffle multiple WAMP messages in a single TLS segment ... and the way TLS Python Twisted interacts .. anyways, details;) |
@oberstet at the moment there is only msgpack and json support for raw sockets. @om26er do you need raw socket at all? |
@konsultaner There is no negotiation in RawSocket by design. KISS;) The client must announce the one serializer it wants to talk, and the router accepts or denies. That's it. No need for ANDing of multiple values. Having said that, I guess we might lack definitions for RAWSOCKET_SERIALIZER_IDs in the spec for RawSocket? Are we indeed? AutobahnPython and Crossbar.io support RawSocket over TCP, TLS, UDS, Pipes and Serial on all supported Serializers ("RAWSOCKET_SERIALIZER_ID"):
|
@oberstet @om26er ok, then well only have this feature for WebSockets. But to be honest, if crossbar supports all them why would some want to choose anyway?
I don't really see a point. but I might do it if I get some time for that. @om26er If you are faster then me, feel free to send a PR. |
I proposed a change to Nexus's WAMP client, which keeps the user-facing API as-is but internally offers a list of serializers to the router if user doesn't specifically request one gammazero/nexus#270 I guess we can do a similar treatment here without changing the user API |
Let me put my 50cents:
This is unclear, and every wamp router can act on it's own. For example Nexus Router choose serializer from it's own list. And JSON is on its first position. So if client sends So what i want to say: it is a good and in my mind useful feature. But we should clearly describe in WAMP specification that this is an ordered list, and that WAMP Router should use the first one supported from its side. |
for wamp-websocket transports, which do use
for wamp-websocket, see RFC6455 for wamp-rawsocket: there is no support for selecting from multiple ones, see my comment #44 (comment) |
Well, I was also thinking so, but in RFC6455 (that i read a lot of course) it is stated like this:
And for server side:
Well I would like to hope that every server choose the first one from client. But for example Nexus works differently :) But I will fix that to desired logic. |
Currently a single serializer needs to be provided to the WebSocketTransport class, it would be very useful to optionally allow to provide a list of serializers based on priority. If the router the "speaks" the first one it gets used, otherwise the next is tried.
It's more of an optimization but the binary serializers are much faster than json.
The text was updated successfully, but these errors were encountered: