-
November 28th, 2017, 06:58 AM
#4
I have changed the functionality as like below,
First created global file and in it created lsclient variable and created a connection on that. And for slave pages I have connected and subscribe the LS Server.
Global Declarationlsconnection.js)
var protocolToUse = document.location.protocol != "file:" ? document.location.protocol : "http:";
var portToUse = document.location.protocol == "https:" ? "443" : "8080";
var lsClient = new Lightstreamer.LightstreamerClient(protocolToUse+"//mydomain.com:"+portToUse,"SLNSTOCKLISTDEMO_REMOTE" );
lsClient.connectionOptions.setHttpExtraHeaders({"u sername" : "bullion"});
lsClient.enableSharing(new Lightstreamer.ConnectionSharing("CommonConnection" , "ATTACH", "CREATE"));
And my all the 3 pages used as like below(slave page)
lsClient.connect();
var liverateSubscription = new Lightstreamer.Subscription("COMMAND", liverateId, fieldList);
//my subscription
var liverateId = "Item";
var fieldList = ["key", "command", "desc", "bid", "ask", "high" , "low", "order"];
var bidaskfieldsList = ["desc", "bid", "ask", "low" , "high", "ratedisplay", "updatetime", "msg"];
var bidaskitemList = ["Gold", "Silver", "INR", "MGold", "MSilver", "Marketstatus"];
var liverateSubscription = new Lightstreamer.Subscription("COMMAND", liverateId, fieldList);
var liverateGrid = new Lightstreamer.DynaGrid("liverates",true);
liverateGrid.setAutoCleanBehavior(true,false);
liverateGrid.addListener({
onVisualUpdate: function(key,info) {
if (info == null) {
return;
}
info.forEachChangedField(function(fieldName,val) {
var lastPrice = info.getChangedFieldValue(fieldName);
if (lastPrice !== null) {
var prevPrice = liverateGrid.getValue(key,fieldName);
if(prevPrice != null){
if (!prevPrice || lastPrice > prevPrice) {
info.setAttribute("#2636f2",null,"backgroundColor" );
info.setAttribute("#FFFFFF",null,"color");
} else {
info.setAttribute("#FF0000",null,"backgroundColor" );
info.setAttribute("#FFFFFF",null,"color");
}
}
} else {
info.setAttribute("",null,"backgroundColor");
info.setAttribute("",null,"color");
}
});
}
});
liverateGrid.setSort("order", false);
liverateSubscription.setDataAdapter("QUOTE_ADAPTER ");
liverateSubscription.setRequestedSnapshot("yes");
liverateSubscription.addListener(liverateGrid);
lsClient.subscribe(liverateSubscription);
It is working without terminate the session. But showing unchanged text everywhere mostly. Whenever the rates getting change at that time only showing the rates, after that showing only UNCHANGED text. Attached the screenshot for your reference.
Similar Threads
-
By dimitarn in forum Client SDKs
Replies: 5
Last Post: December 10th, 2009, 10:52 AM
-
By cbrogliato in forum Client SDKs
Replies: 1
Last Post: October 2nd, 2009, 02:13 PM
-
By codingvn in forum Client SDKs
Replies: 5
Last Post: July 17th, 2008, 10:01 AM
-
By camerone in forum Client SDKs
Replies: 1
Last Post: August 20th, 2007, 02:37 PM
-
Replies: 1
Last Post: March 15th, 2007, 02:44 PM
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 03:13 PM.
Bookmarks