class MyRouter(Router):
def authorize(self, session, uri, action):
print("MyRouter.authorize: {} {} {}".format(uri, IRouter.ACTION_TO_STRING[action]))
return True
The messages I see printed out look like this:
2014-09-08 16:57:25-0500 [WampWebSocketServerProtocol,0,192.168.200.230] MyRouter.authorize: peter 1172178439154025 com.timeservice.now register
2014-09-08 16:58:24-0500 [WampWebSocketServerProtocol,1,127.0.0.1] MyRouter.authorize: db 501145212243207 com.db.start register
2014-09-08 16:58:24-0500 [WampWebSocketServerProtocol,1,127.0.0.1] MyRouter.authorize: db 501145212243207 com.db.stop register
2014-09-08 16:58:30-0500 [WampWebSocketServerProtocol,2,127.0.0.1] MyRouter.authorize: db 8772661627859300 com.db.start call
2014-09-08 16:58:30-0500 [WampWebSocketServerProtocol,1,127.0.0.1] MyRouter.authorize: db 501145212243207 adm.db.connect register
2014-09-08 16:58:30-0500 [WampWebSocketServerProtocol,1,127.0.0.1] MyRouter.authorize: db 501145212243207 adm.db.disconnect register
2014-09-08 16:58:30-0500 [WampWebSocketServerProtocol,1,127.0.0.1] MyRouter.authorize: db 501145212243207 adm.db.query register
2014-09-08 16:58:30-0500 [WampWebSocketServerProtocol,2,127.0.0.1] MyRouter.authorize: db 8772661627859300 adm.db.connect call
2014-09-08 16:58:30-0500 [WampWebSocketServerProtocol,2,127.0.0.1] MyRouter.authorize: db 8772661627859300 adm.session.list call
2014-09-08 17:16:00-0500 [WampWebSocketServerProtocol,4,127.0.0.1] MyRouter.authorize: peter 5553121740255734 com.myapp.topic1 subscribe
2014-09-08 17:17:26-0500 [WampWebSocketServerProtocol,5,127.0.0.1] MyRouter.authorize: peter 2793087355300538 com.myapp.topic1 publish
The call/register are for rpc. Using this technique you could create a class that stores the active subscriptions and publishes and create an rpc call to return the list.
I did run into an issue, though. This is used for authorization. so i guess it already knows if a publish can get to any listeners. I found that if I did a publish without any subscribers the method was never called to authorize the publish. That's weird.
-g