Tweaking AutobahnPython Pub/Sub eligible and exclude to my needs

44 views
Skip to first unread message

Adir Halely

unread,
Oct 4, 2014, 3:10:18 PM10/4/14
to autob...@googlegroups.com
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 :)

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've 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've 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've read routers should not contain application specific code, so I'm kinda confused.

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

Alexander Gödde

unread,
Oct 9, 2014, 10:50:03 AM10/9/14
to autob...@googlegroups.com
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's impossible to say how to best create the user-ID-to-session-ID(s) list.

Regards,

Alex

Adir Halely

unread,
Oct 10, 2014, 5:52:33 AM10/10/14
to autob...@googlegroups.com

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?

--
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" 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.
Reply all
Reply to author
Forward
0 new messages