Table.onEndOfSnapshot not being called
I'm trying to get Table.onEndOfSnapshot to be called once a snapshot has been sent. In the Portfolio demo that comes with Lightstreamer (pages/demos/PortfolioDemo/portfolio.js), I inserted the following line:
Code:
table.setDataAdapter("PORTFOLIO_ADAPTER"); // first-level Data Adapter
table.setUnderDataAdapter("QUOTE_ADAPTER"); // second-level Data Adapter
table.setSnapshotRequired(true);
table.setPushedHtmlEnabled(false);
table.onEndOfSnapshot = function(itemPos, itemName) {
alert('end of snapshot');
};
I was expecting to get an alert when the snapshot was sent. But nothing happens.
In the server's log file, I do see this:
Code:
portfolio1: snapshot sent
which is sent by the PortfolioDataAdapter Java class, right after it calls listener.smartEndOfSnapshot().
Does anyone know why onEndOfSnapshot isn't being called?
All Data Has Been Pushed?
Have a few questions related to the end of snapshot / whether all of the data has been pushed:
1) It looks like the only functional difference between onEndOfSnapshot and OnSnapshotEnd (Lightstreamer .NET Client version) is the removal of itemPos. Is this correct? Do they essentailly provide the same functionality?
2) The onEndOfSnapshot (using COMMAND) only seems to trigger when a client first makes a connection to Lightstreamer. If it is a new subscription, it triggers before any of the items are sent. If it the subsciption is being reused, it triggers after all of the items are sent. This is because the snapshot is only data that has accumulated before subscription time, yes?
3) So is there a way to tell when all of the items an adapter is passing to a client have been recieved? The onEndOfSnapshot seems to work ONLY if the subscription had already been made and only on init (not for any updates). This answer was unclear from the previous post since a two level push was used and this is just referring to the 'one level push'. An alternative would seem to be to have Lightstreamer send the number of upcoming pushes beforehand and then do a count on the client side.
Thanks.