How to get the session information in a RPC function ?

#1

Hello,

Is there a way to get the session information within the rpc function ? (same session information as we get in an authorizer)

Best regards.

0 Likes

#2

I tried to add options=RegisterOptions(details_arg=‘details’)
to the register function, and I do get a CallDetails, but with all its attributes to None

···

On Monday, March 16, 2015 at 3:00:32 PM UTC+1, Rejo wrote:

Hello,

Is there a way to get the session information within the rpc function ? (same session information as we get in an authorizer)

Best regards.

0 Likes

#3

I tried to add options=RegisterOptions(details_arg='details')
to the register function, and I do get a CallDetails, but with all its
attributes to None

To receive caller details, you need to:

1) register with RegisterOptions() to announce you are willing to receive details

2) disclose the caller, by issuing the call with CallOptions(disclose_me=True)

Your details will then have the "caller" attribute, which is the WAMP session ID of the caller.

To get more information about the caller (such as IP or transport or auth), you need to use metaevent

wamp.session.on_join

Here you will get everything. You can store that locally, and then look it up as need in your procedure that only gets the session ID.

This is to avoid sending all and every detail on each call ..

Hope this helps - let me know if not;)
/Tobias

···

Am 16.03.2015 um 15:07 schrieb Rejo:

On Monday, March 16, 2015 at 3:00:32 PM UTC+1, Rejo wrote:

    Hello,

    Is there a way to get the session information within the rpc
    function ? (same session information as we get in an authorizer)

    Best regards.

--
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/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#4

To get more information about the caller (such as IP or transport or

auth), you need to use metaevent

wamp.session.on_join

Here you will get everything. You can store that locally, and then look

it up as need in your procedure that only gets the session ID.

Is on_join sent retro-actively?

···
0 Likes

#5

Thanks Tobias,

Ok, I was missing the “disclose_me=True” in the call.

But, on the backend, I don’t want to rely on the caller to get this information. I’d rather prefer a way for the callee to specify it needs this information everytime, whatever the caller wants to do. This is also the case for a subscribe, I need to know who published.

Another wish would be to allow to pass the options parameters to the @register decorator :slight_smile:

···

On Monday, March 16, 2015 at 3:13:22 PM UTC+1, Tobias Oberstein wrote:

Am 16.03.2015 um 15:07 schrieb Rejo:

I tried to add options=RegisterOptions(details_arg=‘details’)

to the register function, and I do get a CallDetails, but with all its

attributes to None

To receive caller details, you need to:

  1. register with RegisterOptions() to announce you are willing to
    receive details

  2. disclose the caller, by issuing the call with
    CallOptions(disclose_me=True)

Your details will then have the “caller” attribute, which is the WAMP
session ID of the caller.

To get more information about the caller (such as IP or transport or
auth), you need to use metaevent

wamp.session.on_join

Here you will get everything. You can store that locally, and then look
it up as need in your procedure that only gets the session ID.

This is to avoid sending all and every detail on each call …

Hope this helps - let me know if not;)

/Tobias

On Monday, March 16, 2015 at 3:00:32 PM UTC+1, Rejo wrote:

Hello,
Is there a way to get the session information within the rpc
function ? (same session information as we get in an authorizer)
Best regards.

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+unsub...@googlegroups.com.

To post to this group, send email to auto...@googlegroups.com

mailto:autob...@googlegroups.com.

To view this discussion on the web visit

https://groups.google.com/d/msgid/autobahnws/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com

<https://groups.google.com/d/msgid/autobahnws/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com?utm_medium=email&utm_source=footer>.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#6

Hi Rejo,

Thanks Tobias,

Ok, I was missing the "disclose_me=True" in the call.

But, on the backend, I don't want to rely on the caller to get this
information. I'd rather prefer a way for the callee to specify it needs

AutobahnJS already has global options for making each call/publish with disclose_me == true.

AutobahnPython will have it too.

this information everytime, whatever the caller wants to do. This is

The problem with this approach is, that we are no longer able to serialize e.g. a PubSub event once (per serializer), as subscriber A wants details, but subscriber B not.

And this is a scalability issue.

Hence, only 2 entities should decide: either the caller/publisher or the router. Not the callee/subscriber.

also the case for a subscribe, I need to know who published.

It works the same for PubSub (there are options to set for subscriber and publisher)

Another wish would be to allow to pass the options parameters to the
@register decorator :slight_smile:

Yes, there is an issue for that I think ..

/Tobias

···

Am 16.03.2015 um 15:49 schrieb Rejo:

On Monday, March 16, 2015 at 3:13:22 PM UTC+1, Tobias Oberstein wrote:

    Am 16.03.2015 um 15:07 schrieb Rejo:
     > I tried to add options=RegisterOptions(details_arg='details')
     > to the register function, and I do get a CallDetails, but with
    all its
     > attributes to None

    To receive caller details, you need to:

    1) register with RegisterOptions() to announce you are willing to
    receive details

    2) disclose the caller, by issuing the call with
    CallOptions(disclose_me=True)

    Your details will then have the "caller" attribute, which is the WAMP
    session ID of the caller.

    To get more information about the caller (such as IP or transport or
    auth), you need to use metaevent

    wamp.session.on_join

    Here you will get everything. You can store that locally, and then look
    it up as need in your procedure that only gets the session ID.

    This is to avoid sending all and every detail on each call ..

    Hope this helps - let me know if not;)
    /Tobias

     >
     > On Monday, March 16, 2015 at 3:00:32 PM UTC+1, Rejo wrote:
     >
     > Hello,
     >
     > Is there a way to get the session information within the rpc
     > function ? (same session information as we get in an authorizer)
     >
     > Best regards.
     >
     > --
     > 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 autobah...@googlegroups.com <javascript:>
     > <mailto:autobahnws+...@googlegroups.com <javascript:>>.
     > To post to this group, send email to auto...@googlegroups.com
    <javascript:>
     > <mailto:auto...@googlegroups.com <javascript:>>.
     > To view this discussion on the web visit
     >
    https://groups.google.com/d/msgid/autobahnws/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com
    <https://groups.google.com/d/msgid/autobahnws/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com>

     >
    <https://groups.google.com/d/msgid/autobahnws/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com?utm_medium=email&utm_source=footer
    <https://groups.google.com/d/msgid/autobahnws/86c25f21-6d93-41cc-a297-17c90091d354%40googlegroups.com?utm_medium=email&utm_source=footer>>.

     > For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
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/4d467526-29b2-4a0e-8a27-da29e251c7d5%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/4d467526-29b2-4a0e-8a27-da29e251c7d5%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#7

Hi Pierre,

    To get more information about the caller (such as IP or transport or
    auth), you need to use metaevent

    wamp.session.on_join

    Here you will get everything. You can store that locally, and then look
    it up as need in your procedure that only gets the session ID.

Is on_join sent retro-actively?

Heh, "retro-actively"? What do you mean?

It works like this:

When a session joins, the wamp.session.on_join meta event will be triggered immediately.

If you missed this event (because eg your monitoring session wasn't online as the other session joined), you can use meta procs:

wamp.session.list
wamp.session.get

http://crossbar.io/docs/Session-Metaevents-and-Procedures/

Not what you looking for?

Cheers,
/Tobias

···

Am 16.03.2015 um 15:32 schrieb Pierre Tardy:

--
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/CAJ%2BsoVftE9rH6ZfguTxT5hyzYvweFP9eNdmnHUOW7wxMrYpm9w%40mail.gmail.com
<https://groups.google.com/d/msgid/autobahnws/CAJ%2BsoVftE9rH6ZfguTxT5hyzYvweFP9eNdmnHUOW7wxMrYpm9w%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#8

Hi Rejo,

Thanks Tobias,

Ok, I was missing the “disclose_me=True” in the call.

But, on the backend, I don’t want to rely on the caller to get this

information. I’d rather prefer a way for the callee to specify it needs

AutobahnJS already has global options for making each call/publish with
disclose_me == true.

AutobahnPython will have it too.

this information everytime, whatever the caller wants to do. This is

The problem with this approach is, that we are no longer able to
serialize e.g. a PubSub event once (per serializer), as subscriber A
wants details, but subscriber B not.

If subscriber B does not want details, it won’t ask for them while registrering, no ?

And this is a scalability issue.

Hence, only 2 entities should decide: either the caller/publisher or the
router. Not the callee/subscriber.

in a frontend/backend schema, what the backend needs must not be under the responsability of the frontend and frontends should not be able to decide if they get more information than what the backend wants to send… (my personal opinion of course)

In wamp architecture, there is no such things as backends and frontends. I see one place where we could decide whether to send the session information to the callee, subscriber if they asked for: the dynamic authorizer could return more than True of False and tell the router to force the transmission of caller/session reference (simply putting the “not False” result of the authorizer in the caller attribute (or another attribute) of the CallDetails object ??)

···

On Monday, March 16, 2015 at 4:00:48 PM UTC+1, Tobias Oberstein wrote:

Am 16.03.2015 um 15:49 schrieb Rejo:

0 Likes

#9

Is on_join sent retro-actively?

Heh, “retro-actively”? What do you mean?

Hum, that might be a francism :wink:

It works like this:

When a session joins, the wamp.session.on_join meta event will be

triggered immediately.

If you missed this event (because eg your monitoring session wasn’t

online as the other session joined), you can use meta procs:

wamp.session.list

wamp.session.get

http://crossbar.io/docs/Session-Metaevents-and-Procedures/

Not what you looking for?

Ok cool, I think that is answering the question.

I need to register on that 72hours-a-day program to get the time to play with this. :slight_smile:

0 Likes