-
October 7th, 2008, 08:58 AM
#1
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
-
October 7th, 2008, 09:38 AM
#2
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.
-
October 7th, 2008, 01:20 PM
#3
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?
-
October 7th, 2008, 02:33 PM
#4
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
-
October 7th, 2008, 03:08 PM
#5
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"]
}
-
October 8th, 2008, 08:09 AM
#6
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
-
By abhijeetgk in forum Adapter SDKs
Replies: 1
Last Post: September 28th, 2011, 10:53 AM
-
By bartol82 in forum Adapter SDKs
Replies: 1
Last Post: August 30th, 2011, 10:15 AM
-
By Otake in forum Client SDKs
Replies: 5
Last Post: December 17th, 2009, 02:15 PM
-
By nagakumaran in forum Adapter SDKs
Replies: 6
Last Post: October 16th, 2007, 02:11 PM
-
By Mone in forum Client SDKs
Replies: 2
Last Post: May 7th, 2007, 02:59 PM
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 03:18 PM.
Bookmarks