What's join() does ?

#1

Going through this : https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py

I'm wondering what's self.join do :

def onConnect(self):

self.join(self._realm)

I looked at the implementation "autobahn/wamp/protocol.py" but it wasn't clear what does it do. And when does it happen ? Why would you hook you on onJoin instead of onConnect ?

I apologize if it's a noob question, I'm not familiar with the twisted API or the WAMP standard.
0 Likes

#2

Hello Michel,

Going through this :
https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py

I'm wondering what's self.join do :

def onConnect(self):
self.join(self._realm)

A session needs to "join a realm"

https://github.com/tavendo/WAMP/blob/master/spec/basic.md#realms-sessions-and-transports

Above method will send a HELLO message under the hood

https://github.com/tavendo/WAMP/blob/master/spec/basic.md#session-establishment

I looked at the implementation "autobahn/wamp/protocol.py" but it wasn't
clear what does it do. And when does it happen ? Why would you hook you

onJoin() fires when the underlying transport has been established

https://github.com/tavendo/AutobahnPython/blob/master/autobahn/autobahn/wamp/interfaces.py#L216

on onJoin instead of onConnect ?

Most of the time, you'll be using onJoin() as entry point into your actual app code.

The onConnect() hook can be used if you want to do anything after transport has been established but before joining a realm ..

I apologize if it's a noob question, I'm not familiar with the twisted
API or the WAMP standard.

Nothing to apologize .. the docs are clearly still lacking ..

···

Am 24.03.2014 10:40, schrieb Michel Desmoulin:

--
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>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

I found this :

http://autobahn.ws/python/reference/wamp2.html#session-details

It answers my questions :slight_smile:

By the way, can you use the session for authentication purpose, and if yes, how ?

···

On Monday, March 24, 2014 10:40:39 AM UTC+1, Michel Desmoulin wrote:


Going through this : [https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py](https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py)

I'm wondering what's self.join do :

def onConnect(self):

self.join(self._realm)

I looked at the implementation “autobahn/wamp/protocol.py” but it wasn’t clear what does it do. And when does it happen ? Why would you hook you on onJoin instead of onConnect ?

I apologize if it’s a noob question, I’m not familiar with the twisted API or the WAMP standard.

0 Likes

#4

I found this :

http://autobahn.ws/python/reference/wamp2.html#session-details

It answers my questions :slight_smile:

By the way, can you use the session for authentication purpose, and if
yes, how ?

Yes: https://github.com/crossbario/crossbar/wiki/Authentication

Note: this is alpha .. authentication and authorization .. but the foundation (WAMP and AutobahnPython/JS) is there ..

If you really want to dive deep into code, here are 2 pointers

https://github.com/crossbario/crossbar/blob/master/crossbar2/crossbar/router/router.py#L55

https://github.com/crossbario/crossbar/blob/master/crossbar2/crossbar/router/router.py#L310

···

Am 24.03.2014 11:01, schrieb Michel Desmoulin:

On Monday, March 24, 2014 10:40:39 AM UTC+1, Michel Desmoulin wrote:

    Going through this :
    https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py
    <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py>

    I'm wondering what's self.join do :

    def onConnect(self):
    self.join(self._realm)

    I looked at the implementation "autobahn/wamp/protocol.py" but it
    wasn't clear what does it do. And when does it happen ? Why would
    you hook you on onJoin instead of onConnect ?

    I apologize if it's a noob question, I'm not familiar with the
    twisted API or the WAMP standard.

--
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>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#5

Thanks a lot.

···

On Monday, March 24, 2014 10:40:39 AM UTC+1, Michel Desmoulin wrote:


Going through this : [https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py](https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/basic/pubsub/decorators/backend.py)

I'm wondering what's self.join do :

def onConnect(self):

self.join(self._realm)

I looked at the implementation “autobahn/wamp/protocol.py” but it wasn’t clear what does it do. And when does it happen ? Why would you hook you on onJoin instead of onConnect ?

I apologize if it’s a noob question, I’m not familiar with the twisted API or the WAMP standard.

0 Likes