-
February 10th, 2013, 10:11 PM
#1
Allow or Disallow a Subscription
Hello,
When a user requests a subscription to in item, I want LightStreamer to ask me whether the user is allowed to subscribe to that item. I see how I can implement a method in the metadata provider to check the user's user name and password, but how can I instruct LightStreamer with regard to subscriptions to individual items?
Thank you.
-Dan
-
February 11th, 2013, 08:20 AM
#2
Hi,
You can do that by throwing a CreditsException from the notifyNewTable method of the MetadataProvider. Note that you need to return true from the wantsTablesNotifications for the notifyNewTable method to be called
Another way would be to make the check in the getItems method and hijack not-permitted item names to different dummy items; in this case you don't have the user name to do the check but the session id so you should leverage the notifyNewSession and notifySessionClose to keep an index of your user-sessions.
-
February 11th, 2013, 07:37 PM
#3
Thanks, Mone. I guess notifyNewTable method gets called for each new subscription. Is that right?
-
February 12th, 2013, 08:26 AM
#4
Yes exactly; keep in mind that a single subscription may contain several items, anyway you have all the needed information in the notifyNewTable to take your decisions.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 07:55 PM.
Bookmarks