self.leave(log_message=u"test") -> onLeave(details) message==None?

#1

I am subclassing the ApplicationSession:

class Component(ApplicationSession):

``

@inlineCallbacks
def onJoin(self, details):
    log.msg("onJoin session attached {}".format(details))
    try:
        reg = yield self.register('com.test',
            RegisterOptions(details_arg = 'details'))
    except Exception as e:
        log.msg("onJoin register exception {} {}".format('com.test', e))
        self.leave(reason=u'my.application.error', log_message=six.u('test'))

``

def onLeave(self, details):
    sys.stderr.write("Leaving realm : {}\n".format(details))
    log.msg("onLeave: {}".format(details))
    self.disconnect()
    return

``

This is catching the exception where I already have this application running and the register() is a duplicate. What is the proper usage for leave()? Mine is printing this:

Leaving realm : CloseDetails(reason = wamp.goodbye.normal, message = ‘None’’)

-g

0 Likes

#2

The API is documented here:

http://autobahn.ws/python/reference/autobahn.wamp.html#autobahn.wamp.interfaces.ISession.leave

There is no “log_message” parameter in leave(), and the “details” you get in onLeave do come from the peer …

···

Am Montag, 1. Dezember 2014 18:03:39 UTC+1 schrieb Greg Fausak:

I am subclassing the ApplicationSession:

class Component(ApplicationSession):

``

@inlineCallbacks
def onJoin(self, details):
    log.msg("onJoin session attached {}".format(details))
    try:
        reg = yield self.register('com.test',
            RegisterOptions(details_arg = 'details'))
    except Exception as e:
        log.msg("onJoin register exception {} {}".format('com.test', e))
        self.leave(reason=u'my.application.error', log_message=six.u('test'))

``

def onLeave(self, details):
    sys.stderr.write("Leaving realm : {}\n".format(details))
    log.msg("onLeave: {}".format(details))
    self.disconnect()
    return

``

This is catching the exception where I already have this application running and the register() is a duplicate. What is the proper usage for leave()? Mine is printing this:

Leaving realm : CloseDetails(reason = wamp.goodbye.normal, message = ‘None’’)

-g

0 Likes

#3

of course! thanks! the devil is in the “details”

-g

···

On Friday, December 5, 2014 8:07:36 AM UTC-6, Tobias Oberstein wrote:

The API is documented here:

http://autobahn.ws/python/reference/autobahn.wamp.html#autobahn.wamp.interfaces.ISession.leave

There is no “log_message” parameter in leave(), and the “details” you get in onLeave do come from the peer …

Am Montag, 1. Dezember 2014 18:03:39 UTC+1 schrieb Greg Fausak:

I am subclassing the ApplicationSession:

class Component(ApplicationSession):

``

@inlineCallbacks
def onJoin(self, details):
    log.msg("onJoin session attached {}".format(details))
    try:
        reg = yield self.register('com.test',
            RegisterOptions(details_arg = 'details'))
    except Exception as e:
        log.msg("onJoin register exception {} {}".format('com.test', e))
        self.leave(reason=u'my.application.error', log_message=six.u('test'))

``

def onLeave(self, details):
    sys.stderr.write("Leaving realm : {}\n".format(details))
    log.msg("onLeave: {}".format(details))
    self.disconnect()
    return

``

This is catching the exception where I already have this application running and the register() is a duplicate. What is the proper usage for leave()? Mine is printing this:

Leaving realm : CloseDetails(reason = wamp.goodbye.normal, message = ‘None’’)

-g

0 Likes