Getting the current number of publishers and subscribers

#1

Hey all,

I’m using Autobahn with Crossbar.io and I wanted to know if there is a way to obtain the current number of publishers and subscribers registered. For example, if a set of publishers and subscribers get registered, how can I poll the system to find the number of publishers and subscribers at the time of the query?

Thank you for your help.

Justin

0 Likes

#2

Hi Justin,

> I'm using Autobahn with Crossbar.io and I wanted to know if there is a

way to obtain the current number of publishers and subscribers
registered. For example, if a set of publishers and subscribers get
registered, how can I poll the system to find the number of publishers
and subscribers at the time of the query?

Publishers aren't "registered" in any way. Consequently, there cannot be an API for listing them.

Subscribers are known to the Router of course. And the way Routers may expose that is via a meta API:

https://github.com/tavendo/WAMP/blob/master/spec/advanced.md#subscriber-list

These features are part of the "advanced profile" of WAMP, are not yet fully specified, and not implemented (in Crossbar).

/Tobias

···

Thank you for your help.

Justin

--
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/9024a395-9575-4468-be57-dbe095e6cf5a%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/9024a395-9575-4468-be57-dbe095e6cf5a%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

Thank you for your help.

Is there a way to access this data through the router (is there some interface to the router that exposes this information currently), or is this information strictly internal to the router?

Justin

···

On Tuesday, September 2, 2014 3:58:42 PM UTC-4, Justin Albano wrote:

Hey all,

I’m using Autobahn with Crossbar.io and I wanted to know if there is a way to obtain the current number of publishers and subscribers registered. For example, if a set of publishers and subscribers get registered, how can I poll the system to find the number of publishers and subscribers at the time of the query?

Thank you for your help.

Justin

0 Likes

#4

You might be able to access the data, but, I think it would be internal to Autobahn. Something you might consider is intercepting the authorize() method in the Router. I modified mine like this (in basicrouter.py):

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

···

On Monday, September 8, 2014 1:09:43 PM UTC-5, Justin Albano wrote:

Thank you for your help.

Is there a way to access this data through the router (is there some interface to the router that exposes this information currently), or is this information strictly internal to the router?

Justin

On Tuesday, September 2, 2014 3:58:42 PM UTC-4, Justin Albano wrote:

Hey all,

I’m using Autobahn with Crossbar.io and I wanted to know if there is a way to obtain the current number of publishers and subscribers registered. For example, if a set of publishers and subscribers get registered, how can I poll the system to find the number of publishers and subscribers at the time of the query?

Thank you for your help.

Justin

0 Likes

#5

Thank you for your help.

Is there a way to access this data through the router (is there some
interface to the router that exposes this information currently), or is
this information strictly internal to the router?

As said, the information does not exist ("list of publishers") or is exposed via meta API (if implemented by the router).

···

Am 08.09.2014 20:09, schrieb Justin Albano:

Justin

On Tuesday, September 2, 2014 3:58:42 PM UTC-4, Justin Albano wrote:

    Hey all,

    I'm using Autobahn with Crossbar.io and I wanted to know if there is
    a way to obtain the current number of publishers and subscribers
    registered. For example, if a set of publishers and subscribers get
    registered, how can I poll the system to find the number of
    publishers and subscribers at the time of the query?

    Thank you for your help.

    Justin

--
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/a5b230b8-c8f3-4d0f-a736-430ff14828fb%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/a5b230b8-c8f3-4d0f-a736-430ff14828fb%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes