Closed bharath3719 closed 4 years ago
Your realm has a TopicContainer
which has methods like GetTopicByUri
etc.
You can also register to TopicContainer.TopicCreated
if you want to get a notification when a new topic has been created.
I want to know which user has subscribed to which topic.
Registering to TopicContainer.TopicCreated , i dont get sessionId in WampTopicCreatedEventArgs e to make a mapping..
Register to TopicCreated
and there register to the SubscriptionAdded
, SubscriptionRemoved
events of the IWampTopic
. Also consider using the WampMetaApi mechanism which keeps track of these for you.
Elad
Hi Elad,
In my case, i don't know the topics that my clients are going to subscribe to(it will be dynamic)
SubscriptionAdded
is getting called the first time when we add authorizedTopics . (Correct me if im wrong)
When client(autobahn.js) initiates a connection with router with a user specific topic , SubscriptionAdded
is not getting called.
helloDetails
and welcomeDetails
in WampSessionCreatedEventArgs
is not giving me the topic which the user has subscribed to.
And i hostedmetaAPI service like below: and there also i dont see which topic user has subscribed to
_metaApiService = _realm.HostMetaApiService();
You are wrong. These events are raised whenever a new topic is created, even if a client initiated the topic creation. You are probably not using the correct realm name on the server side. Another possibility is that you opened several WampHosts and you are looking at the wrong one.
The fact that the topics don't appear also in the meta-api service only suggests that you're looking at the wrong realm or the wrong WampHost.
Elad
On Thu, Feb 20, 2020, 07:46 bharath3719 notifications@github.com wrote:
Hi Elad,
In my case, i don't know the topics that my clients are going to subscribe to(it will be dynamic)
SubscriptionAdded is getting called the first time when we add authorizedTopics . (Correct me if im wrong)
When client(autobahn.js) initiates a connection with router with a user specific topic , SubscriptionAdded is not getting called.
helloDetails and welcomeDetails in WampSessionCreatedEventArgs is not giving me the topic which the user has subscribed to.
And i hostedmetaAPI service like below: and there also i dont see which topic user has subscribed to
_metaApiService = _realm.HostMetaApiService();
[image: image] https://user-images.githubusercontent.com/19222968/74934805-01d0f180-540d-11ea-8839-05214987534b.png
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Code-Sharp/WampSharp/issues/313?email_source=notifications&email_token=AAIS75SKLB6JJWGXITRB47LRDZ3RXA5CNFSM4KSDYRIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMNXYKA#issuecomment-589003816, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIS75QWH76IHCLKTUBZYQDRDZ3RXANCNFSM4KSDYRIA .
If you want to continue discussing this and want my help please provide a standalone repro (a single minimal cs file) that doesn't work. Respect me and my time by using the bug template for issues that I set for this repository.
Elad
i have only one realm and wampHost.
where can i find bug template
i am getting below error if client initiates topic creation and if that topic is not there in authorizedTopics.
Potentially unhandled rejection [1] {"error":"wamp.error.not_authorized","args":[],"kwargs":{}}
When you open a new issue, choose the bug template.
Your current problem is that your clients are not allowed to subscribe to these topics. Implement a WampAuthorizer that allows them to subscribe by returning true from the CanSubscribe
method. If you're using the built in WampCraDb
implementation, maybe try using Prefix
or Wildcard
, I don't exactly remember the name.
looks like clients cannot subscribe to topics which are not in authorizedTopics list. Its fixed now . thanks for your inputs
authorizedTopics
is not something that is defined in WampSharp, it is part of your code. Please be more careful with this in the future, I have no idea what is going on in your codebase.
Elad
private void Realm_SessionCreated(dynamic sender, WampSessionCreatedEventArgs e) { _logger.LogInfo("A session is opened. ID: " + e.SessionId.ToString());