Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Dec 2011
    Location
    London
    Posts
    6

    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

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    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.

  3. #3
    Member
    Join Date
    Dec 2011
    Location
    London
    Posts
    6
    Thanks, Mone. I guess notifyNewTable method gets called for each new subscription. Is that right?

  4. #4
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 08:48 PM.