Tweaking AutobahnPython Pub/Sub eligible and exclude to my needs

#1

I have RoR based web application that pushes notifications to a message queue.
Users get notified with the help of AutobahnJS(PubSub), connected to an AutobahnPython backend.
The notifications are being dequeued by my ApplicationSession and published to everyone :slight_smile:
My problem is selective publishing.
WAMP contains eligible and exclude in the protocol to publish by WAMP session IDs.
But what I want is to publish to my users by their user IDs(stored in my database).
I鈥檝e managed to implement my WampWebSocketServerProtocol and modify onConnect to authenticate the user(by his Rails session cookie) and store his ID in the protocol object.
I鈥檝e not sure how to proceed from here, do I need to hack the publish method in the broker, or maybe the router is more relevent?
From what I鈥檝e read routers should not contain application specific code, so I鈥檓 kinda confused.

It鈥檚 worth mentioning I鈥檓 currently using a modified version of ApplicationRunner to host my ApplicationSession with my modified server protocol.
I鈥檓 read about Crossbar.io and I鈥檓 considering using it, can it assist me in this case?

0 Likes

#2

Hi!

Just a few comments:

  • Routers should not contain application specific code. Try everything else before thinking about adding modifications here. Your application should be able to use any WAMP router that has the feature set you are using.

  • What you need is to coordinate user IDs and the WAMP session ID or IDs currently associated with a user. This should happen in the publisher (presumably your AutobahnPython backend), so that this can then publish with the relevant eligible list. Without knowledge of your application, it鈥檚 impossible to say how to best create the user-ID-to-session-ID(s) list.

Regards,

Alex

路路路

Am Samstag, 4. Oktober 2014 21:10:18 UTC+2 schrieb Adir Halely:

I have RoR based web application that pushes notifications to a message queue.
Users get notified with the help of AutobahnJS(PubSub), connected to an AutobahnPython backend.
The notifications are being dequeued by my ApplicationSession and published to everyone :slight_smile:
My problem is selective publishing.
WAMP contains eligible and exclude in the protocol to publish by WAMP session IDs.
But what I want is to publish to my users by their user IDs(stored in my database).
I鈥檝e managed to implement my WampWebSocketServerProtocol and modify onConnect to authenticate the user(by his Rails session cookie) and store his ID in the protocol object.
I鈥檝e not sure how to proceed from here, do I need to hack the publish method in the broker, or maybe the router is more relevent?
From what I鈥檝e read routers should not contain application specific code, so I鈥檓 kinda confused.

It鈥檚 worth mentioning I鈥檓 currently using a modified version of ApplicationRunner to host my ApplicationSession with my modified server protocol.
I鈥檓 read about Crossbar.io and I鈥檓 considering using it, can it assist me in this case?

0 Likes

#3

When users connect to the WebSockets back end I parse their request headers and extract the Rails session cookie. Then I send a new GET request to mydomain.com/user/id with the extracted Rails session cookie to query his user ID.

Where does this kind of application code apply in the WAMP protocol?

路路路

On Oct 9, 2014 5:50 PM, 鈥淎lexander G枚dde鈥 alexande...@googlemail.com wrote:

Hi!

Just a few comments:

  • Routers should not contain application specific code. Try everything else before thinking about adding modifications here. Your application should be able to use any WAMP router that has the feature set you are using.
  • What you need is to coordinate user IDs and the WAMP session ID or IDs currently associated with a user. This should happen in the publisher (presumably your AutobahnPython backend), so that this can then publish with the relevant eligible list. Without knowledge of your application, it鈥檚 impossible to say how to best create the user-ID-to-session-ID(s) list.

Regards,

Alex

Am Samstag, 4. Oktober 2014 21:10:18 UTC+2 schrieb Adir Halely:

I have RoR based web application that pushes notifications to a message queue.
Users get notified with the help of AutobahnJS(PubSub), connected to an AutobahnPython backend.
The notifications are being dequeued by my ApplicationSession and published to everyone :slight_smile:
My problem is selective publishing.
WAMP contains eligible and exclude in the protocol to publish by WAMP session IDs.
But what I want is to publish to my users by their user IDs(stored in my database).
I鈥檝e managed to implement my WampWebSocketServerProtocol and modify onConnect to authenticate the user(by his Rails session cookie) and store his ID in the protocol object.
I鈥檝e not sure how to proceed from here, do I need to hack the publish method in the broker, or maybe the router is more relevent?
From what I鈥檝e read routers should not contain application specific code, so I鈥檓 kinda confused.

It鈥檚 worth mentioning I鈥檓 currently using a modified version of ApplicationRunner to host my ApplicationSession with my modified server protocol.
I鈥檓 read about Crossbar.io and I鈥檓 considering using it, can it assist me in this case?

You received this message because you are subscribed to a topic in the Google Groups 鈥淎utobahn鈥 group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/RKh2jCO5gkU/unsubscribe.

To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/a1ff694d-9911-4b6a-93b3-ed5003cf43b4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes