Dawoodshah100 0 Report post Posted April 17, 2018 I have this Subscription File and I need to update the static or dyna grid but I can not do it with any of these. Kindly Help Subscriptions.js Share this post Link to post
Physicsman 26 Report post Posted April 17, 2018 Hi, A couple of points. 1) Please repost the javascript file as a text file so that it can be downloaded through our security protocols and the code examined. 2) Please provide more detail to your issues such as: what you are attempting to do, how you are attempting to do it, and what the problem you are encountering is. Note: we can only help where your problem is directly related to the API webservices as documented at: http://docs.labs.cityindex.com/. Kind Regards, PM! Share this post Link to post
Dawoodshah100 0 Report post Posted April 17, 2018 define(["js/lsClient","Subscription","StaticGrid"], function(lsClient,Subscription,StaticGrid) { lsClient.connect(); var stocksGrid = new StaticGrid("stocks",true); stocksGrid.setAutoCleanBehavior(true,false); stocksGrid.addListener({ onVisualUpdate: function(key,info) { if (info == null) { //cleaning return; } var cold = (key.substring(4) % 2 == 1) ? "#eeeeee" : "#ddddee"; info.setAttribute("yellow", cold, "backgroundColor"); } }); // var abc=stocksGrid.extractItemList(); // var abcd=stocksGrid.extractFieldList(); var stockSubscription = new Subscription("MERGE",stocksGrid.extractItemList(),["MarketId", "TickDate", "Bid", "Offer", "Price","High","Low", "Change", "Direction", "Delta", "ImpliedVolatility", "AuditId", "StatusSummary"]); stockSubscription.addListener(stocksGrid); stockSubscription.setItems(["PRICES.PRICE.99588"]); stockSubscription.setDataAdapter("PRICES"); stockSubscription.setRequestedSnapshot("yes"); lsClient.subscribe(stockSubscription); lsClient.connect() }); This is the Code, Now I want to Update the Static Grid but there is no Update from the stream. The HTML Code is <!-- stock table --> <table cellspacing="0" cellpadding="2" border="0" > <tr class="tableTitle"> <!-- <td width="148" style="text-align: left">Name</td>--> <td width="42">MarketId</td> <td width="64" style="text-align: center">TickDate</td> <td width="61">Bid</td> <td width="50">Offer</td> <td width="50">Price</td> <td width="50">High</td> <td width="50">Low</td> <td width="50">Change</td> <td width="50">Direction</td> <td width="50">Delta</td> <td width="50">ImpliedVolatility</td> <td width="50">AuditId</td> <td width="50">StatusSummary</td> </tr> <tr class="coldOdd"> <!-- <td nowrap="nowrap" style="text-align: left"><div class="stockNameOdd" data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="stock_name">Loading...</div></td>--> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="MarketId">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="TickDate">-</div></td> <td nowrap="nowrap"><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="Bid">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="Offer">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="Price">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="High">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="Low">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="Change">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="Direction">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="Delta">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="ImpliedVolatility">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="AuditId">-</div></td> <td><div data-source="lightstreamer" data-grid="stocks" data-item="item1" data-field="StatusSummary">-</div></td> </tr> And there are 10 more rows, for data-item= item2.......item10 Share this post Link to post
Dawoodshah100 0 Report post Posted April 17, 2018 I have used ADAPTER: "STREAMINGALL", SERVER: "https://push.cityindex.com/", and lsClient.connectionDetails.setUser("DM454504"); lsClient.connectionDetails.setPassword(Session); //send the token, not the password, to the Lightstreamer server lsClient.connect(); Yet The Grid Doesn't Update Share this post Link to post
Physicsman 26 Report post Posted April 17, 2018 Hi, On a cursory inspection, I suspect it's because you are using MERGE mode, rather than DISTINCT or RAW. The differences between these modes are described from page 18 onwards of the attached Lightstreamer General Concepts.pdf file. If the attached document doesn't help, you can post your Ligthstreamer related query to the Lightstreamer forum at: https://forums.lightstreamer.com/. Kind Regards, PM! Lightstreamer General Concepts.pdf Share this post Link to post
Dawoodshah100 0 Report post Posted April 17, 2018 Ok I will get that, Kindly help in this errorWebSocket connection to 'wss://push.cityindex.com/lightstreamer' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET Share this post Link to post
Physicsman 26 Report post Posted April 17, 2018 I'll take a look at that and reply when I have further information. Kind Regards, PM! Share this post Link to post
Physicsman 26 Report post Posted April 18, 2018 Hi, Our servers are still using Lightstreamer version 5, which does NOT support websockets. It is only from Lightstreamer v6.1 onwards that supports websockets. Kind Regards, PM! Share this post Link to post
Dawoodshah100 0 Report post Posted April 19, 2018 Ok But Now I stream Data by using lightstreamer 5 with websockets, I solved the above problem by updating the data-item="item1" item1,item2.......item3 etc to updating them to Price.{MarketId} like item1 is replaced by Price.99588.... Now the var stockSubscription = new Subscription("MERGE",stocksGrid.extractItemList(),["MarketId", "TickDate", "Bid", "Offer", "Price","High","Low", "Change", "Direction", "Delta", "ImpliedVolatility", "AuditId", "StatusSummary"]); stockSubscription.addListener(stocksGrid); Now stocksGrid.extractItemList() have array of Price.MarketId. And there is no need to use stockSubscription.setItems(["PRICES.PRICE.99588"]); Now. Share this post Link to post
Physicsman 26 Report post Posted April 20, 2018 Hi, Glad to hear you resolved the problem and thank you for updating the thread. Kind Regards, PM! Share this post Link to post