crossbario / crossbario/autobahn-python

Endpoint selected serializers

Open
#723 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-discussion
Dominant language
Python
Stars
2.5k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

An "endpoint" is a caller, callee, publisher or subscriber. Normally, WAMP sticks to least common denominator regarding the app payload, because it wants to provide decoupling from a specific serialization format, and the specific type system supported there, and instead transparently translate between formats.

However, in certain scenarios, where all endpoints are controlled/developed by one entity, that could be felt as "too restrictive".

Think about:

session.register(my_proc, 'com.my_proc', options=RegisterOptions(serializer='cbor'))

That would mean, this callee can only be called with CBOR serialzed invocations from the router so, CBOR callers could call it, JSON callers not. But it would allow pairs of CBOR callers/callees allow to use the full type system of CBOR.

From IRC:

<oberstet_> so it doesnt roundtrip
<oberstet_> and that is exactly my itch
<agronholm> JSON -> CBOR -> JSON should roundtrip
<oberstet_> sure. but that is not a roundtrip;)
<agronholm> what is then
<agronholm> CBOR -> JSON -> CBOR?
<oberstet_> because JSON -> CBOR isn't covering the whole domain of CBOR values
<agronholm> well, that's a given
<agronholm> but we already talked about that
<oberstet_> yes. I was just confused by the section titles in the RFC that somehow seem to suggest that it would roundtrip, while it doesn't
<oberstet_> if you forbid users of JSON to use dicts with attribute key '_cbor_tag', then you could stick the magic onto that. hack, hack, hack ..
<oberstet_> it doesn't really get better. at least my conclusion is, better stick to the least common denominator (plus binary)
<agronholm> but since I am in control of the whole deployment environment, I can choose to use a more advanced serialization scheme throughout
<agronholm> right tools for the job etc. :)
<agronholm> in other situations I might make a different choice of course
<oberstet_> ok, now I am thinking more about if we could come up with an API in AB that would fit that ..
<agronholm> oh?
<agronholm> I should probably read the WAMP 2 spec before I comment
<oberstet_> like in, what if I would register a callee like this: session.register(my_proc, 'com.my_proc', options=RegisterOptions(serializer='cbor'))
<oberstet_> that would mean, this callee can only be called with CBOR serialzed invocations fromthe router
<oberstet_> so, CBOR callers could call it, JSON callers not
<agronholm> mhm
<oberstet_> not hashed out .. but maybe sth like in this direction
<agronholm> if it was me I'd allow JSON callers but if serialization to JSON failed in the CB process, it would turn the response into an error or something
<agronholm> ensuring compatibility is the application developer's responsibility
<oberstet_> weeell. protect the developer;)
<agronholm> the caller would get an exception either way.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the WAMP 2 specification, then inspect the session.register API and RegisterOptions(serializer='cbor') example described here. Resolve whether endpoint-specific serializers should restrict callers or allow conversion failures, and define the API and compatibility behavior that would constitute a complete feature.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.