How to get the session information in a RPC function ?

225 views
Skip to first unread message

Rejo

unread,
Mar 16, 2015, 10:00:32 AM3/16/15
to autob...@googlegroups.com
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.

Rejo

unread,
Mar 16, 2015, 10:07:38 AM3/16/15
to autob...@googlegroups.com
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

Tobias Oberstein

unread,
Mar 16, 2015, 10:13:22 AM3/16/15
to autob...@googlegroups.com
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+...@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.

Pierre Tardy

unread,
Mar 16, 2015, 10:33:01 AM3/16/15
to autob...@googlegroups.com
 
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?


Rejo

unread,
Mar 16, 2015, 10:49:07 AM3/16/15
to autob...@googlegroups.com
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 :-)

Tobias Oberstein

unread,
Mar 16, 2015, 11:00:48 AM3/16/15
to autob...@googlegroups.com
Hi Rejo,

Am 16.03.2015 um 15:49 schrieb 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 :-)

Yes, there is an issue for that I think ..
> > an email to autobahnws+...@googlegroups.com <javascript:>
> > <mailto:autobahnws+...@googlegroups.com <javascript:>>.
> > To post to this group, send email to autob...@googlegroups.com
> <javascript:>
> > <mailto:autob...@googlegroups.com <javascript:>>.
> <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/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>.

Tobias Oberstein

unread,
Mar 16, 2015, 11:07:39 AM3/16/15
to autob...@googlegroups.com
Hi Pierre,
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


>
>
> --
> 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>.

Rejo

unread,
Mar 16, 2015, 11:29:18 AM3/16/15
to autob...@googlegroups.com


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

Am 16.03.2015 um 15:49 schrieb 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 ??)

 

Pierre Tardy

unread,
Mar 16, 2015, 12:03:21 PM3/16/15
to autob...@googlegroups.com

>
> Is on_join sent retro-actively?

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

Hum, that might be a francism ;-)
 

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. :)

Reply all
Reply to author
Forward
0 new messages