Skip to content

Commit

Permalink
WAMP metaevents must be published via the trusted service session on …
Browse files Browse the repository at this point in the history
…the respective router/realm
  • Loading branch information
Tobias Oberstein committed Nov 24, 2014
1 parent 231e1b7 commit be63fcf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions crossbar/crossbar/router/session.py
Expand Up @@ -410,6 +410,15 @@ def error(err):

def onJoin(self, details):

## Router/Realm service session
##
self._service_session = self._router._realm.session

# self._router: crossbar.router.session.CrossbarRouter
# self._router_factory: crossbar.router.session.CrossbarRouterFactory
# self._router._realm: crossbar.worker.router.RouterRealm
# self._router._realm.session: crossbar.router.session.CrossbarRouterServiceSession

self._session_details = {
'authid': details.authid,
'authrole': details.authrole,
Expand All @@ -422,16 +431,15 @@ def onJoin(self, details):

## dispatch session metaevent from WAMP AP
##
msg = message.Publish(0, u'wamp.metaevent.session.on_join', [self._session_details])
self._router.process(self, msg)
self._service_session.publish(u'wamp.metaevent.session.on_join', self._session_details)


def onLeave(self, details):

## dispatch session metaevent from WAMP AP
##
msg = message.Publish(0, u'wamp.metaevent.session.on_leave', [self._session_details])
self._router.process(self, msg)
self._service_session.publish(u'wamp.metaevent.session.on_leave', self._session_details)

self._session_details = None

## if asked to explicitly close the session ..
Expand Down
2 changes: 2 additions & 0 deletions crossbar/crossbar/worker/router.py
Expand Up @@ -183,6 +183,8 @@ def __init__(self, id, config, session):
:type id: str
:param config: The realm configuration.
:type config: dict
:param session: The realm service session.
:type session: instance of CrossbarRouterServiceSession
"""
self.id = id
self.config = config
Expand Down

0 comments on commit be63fcf

Please sign in to comment.