Results 1 to 10 of 10

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30

    dynamically subscribe items

    As far as I've understood, the list of items to be subscribed should be sent by the client(in may case a web client)

    Is it possible to do the following scenario using lightstreamer?

    Depending on the username password sent by web client, lightstreamer connects to the database and gets the list of items relevant to that user. then it sends them back to the client or subscribe those items automatically... and pushes data accordingly. (i.e. web client will send us only the username and we have to subscribe the relevant items for that user)


    regards
    rd

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    517
    Yes, there are several ways to achieve that with Lightstreamer. Here are a couple of options:

    A) The Client specifies a generic group name in its subscription. Your Metadata Adapter, based on the user identity (previously assessed through username and password), will expand such group name into a list of specific items (this is done through the getItems method). With a Web Client, this works well with NonVisualTables; with VisualTables it is better If the client knows in advance how many items it wants to display in that page, in order to prepare the cells.

    B) Use a MultiDynaMetapushTable, released with Web Client v.4.3, to have th Server dynamically push a list of items to the Client (with even the capability of removing items at any times). Take a look at the brand new Portfolio Demo released with Lightstreamer Server v.3.5.

  3. #3
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30

    using nonvisual tables

    Thanks
    happy to here that i'm in the right track. i was doing some POCs with getItems.

    In my case i'm using non visual tables.

    in getItems(user,id) in MetaAdapter i check the user and depending on the user i set different values for the id string (irrespective of whatever is coming as id) I dd no change to the subscribe method in dataadapter.

    still i ddnt get a good response.
    onItemupdate (in javascript) the itemName comes as undefined.... any hints?

  4. #4
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30

    SubscriptionMode

    can it be a issue in subscription mode? I'm using MERGE. all other three (RAW,DISTINCT and COMMAND says that they are not supported for item1

  5. #5
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30
    If i initially send(from javascript) all the names of items, it works without any prob(for the timebeing forget the username password word)

    but if i try to add any item name that is not in the initial list, it is shown as undefined in the onitemupdate event(in js).. (i can dynamically remove items from the list, depending on the user)

    is this relates to the listener.update in dataadapter?

    public String[] getItems(String user, String id) throws ItemsException {
    String group = "item1 "+ "item2 "+"item3 "+"item4 "+"item5 "+"item6";
    return tokenize(group);
    }

    in my javascript
    //var ngroup = ["item1","item2","item3","item4","item5","item6","i tem7"];
    //this works fine and will subscribe only item1 to item6 and updates them correctly
    var ngroup = ["items"];
    var nvTable = new NonVisualTable(ngroup,nschema,"MERGE");
    onItemUpdate
    nvTable.onItemUpdate = function(itemIndex,update,itemName) {
    alert(itemName);// this alerts "undefined" if i use ngroup = ["items"]
    }

  6. #6
    Senior Member
    Join Date
    Sep 2008
    Location
    rmd
    Posts
    30

    onitemupdate

    it gives the correct itemIndex, but not the correct itemName . it seems that it generates the itemName from the group defined in the js, not from the metaadapter.

 

 

Similar Threads

  1. Automatic subscribe to different items
    By abhijeetgk in forum Adapter APIs
    Replies: 1
    Last Post: September 28th, 2011, 11:53 AM
  2. Non-blocking IDataProvider.Subscribe
    By bartol82 in forum Adapter APIs
    Replies: 1
    Last Post: August 30th, 2011, 11:15 AM
  3. Adding/Removing items dynamically
    By Otake in forum Client APIs
    Replies: 5
    Last Post: December 17th, 2009, 03:15 PM
  4. subscribe to items not using threads
    By nagakumaran in forum Adapter APIs
    Replies: 6
    Last Post: October 16th, 2007, 03:11 PM
  5. Dynamically size a table
    By Mone in forum Client APIs
    Replies: 2
    Last Post: May 7th, 2007, 03:59 PM

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 10:54 PM.