-
js getSubscriptions
hi there everyone i am very new to lightstreamer how do you "getSubscriptions" in js,
it says here; http://www.lightstreamer.com/docs/cl...merClient.html
getSubscriptions
Inquiry method that returns an array containing all the Subscription instances that are currently "active" on this LightstreamerClient.
Internal second-level Subscription are not included.
Returns:
An array, containing all the Subscription currently "active" on this LightstreamerClient.
The array can be empty.
Type Array
-
Hi Kurt,
The "getSubscriptions" method returns an array containing all objects of type Subscription currently active, ie all Subscription objects passed as a parameter to the "subscribe" method of the specific instance of LightstreamerClient.
But please note that this method concerns advanced features and is exclusively for special needs.
I do not expect that a beginner who wants to implement some early applications with Lighstreamer needs this method. You can refer to one of our demo here for how to create and properly handle the Subscriptions with the server Lightstreamer.
However, if you specify a little more your needs we can certainly give you further details on how to use the "getSubscriptions" method.
-
hi giuseppe
thanks for letting me know.
could you please help me out here, i am trying to make a simple subscribe with these parameters but doesnt seem to work?:
- mode: MERGE
- table: 1
- snapshot: false
- data_adapter: DEFAULT
- schema: message
- item ID: <computerID>
var item2Subscription = new Subscription("MERGE","item ID",["computerID"]);
item2Subscription.setDataAdapter("DEFAULT");
item2Subscription.setRequestedSnapshot(false);
item2Subscription.addListener({
onSubscription: function() {
subDiv.innerHTML = "SUBSCRIBED";
},
onUnsubscription: function() {
subDiv.innerHTML = "UNSUBSCRIBED";
},
onItemUpdate: function(obj) {
nameSpan.innerHTML = obj.getValue("computerID");
}
});
client.subscribe(item2Subscription);
cheers
kurt
-
Hi Kurt,
you should try with something like this:
var itemID = "<computerID>";
var fieldList = ["message"];
var item2Subscription = new Subscription("MERGE",itemID,fieldList);
item2Subscription.setDataAdapter("DEFAULT");
item2Subscription.setRequestedSnapshot(false);
...
client.subscribe(item2Subscription);
Please also pay attention to the correct determination of the Adapeter Name, which in your case is "DEFAULT" and the Adapter Set Name that is specified when the LightstreamerClient object was created .
However, if you are still in troubles, you should provide us with a server and client log showing the subscription events?
Please set to DEBUG level the "LightstreamerLogger.subscriptions" and "LightstreamerLogger.requests" logger in the "lightstreamer_log_conf.xml".
Also, you should enable logging on the client side. In order to set the client to log at INFO level all of its categories (using *) Client log configuration is described in section 2.6.3 of the development guide: http://www.lightstreamer.com/latest/Lightstreamer_Allegro-Presto-Vivace_5_1_Colosseo/Lightstreamer/DOCS-SDKs/sdk_client_javascript/doc/JavaScript%20Client%20Guide.pdf.
-
var item2Subscription = new Subscription("MERGE",itemID,fieldList);
item2Subscription.setDataAdapter("DEFAULT");
item2Subscription.setRequestedSnapshot(false);
-
Hi arslan1,
Sorry but unfortunately we can not understand the meaning of your last post. How could we help you? Please let us know if you need more information on this thread.
Thanks and Regards,
Gianluca