I use autobahnPython + autobahnJs set up a chatting service.
Now I want to a function, when a client connect wamp, the member list of chatting room be updated automatically. How implement this function?
def onSessionOpen(self):
I think in onSessionOpen function add action, but I don't know how to do next.
One approach would be: have a dedicated PubSub topic per chat room. When a WAMP client subscribes to a "chat room topic", it'll be automatically added to the subscriber list for that chat room. The subscriptions are held in self.factory.subscriptions[<topic URI>]
. Please note that the latter is an internal object .. not a public API. We would need to know more what else you want to do .. i.e. have an RPC to get the current subscribers on a chat room and such.
Disclaimer: I am author of WAMP, Autobahn and work for Tavendo.