Hi trader-123,

I confirm that the isSnapshotAvailable method is only called for the first client subscribing to an item, and that for each subsequent client, there will be no call to get the snapshot.
This is because the Lightstreamer server already knows the snapshot.

Please consider this very simple example: a Data Adapter handling a single Item, let's call it A, with only a field last_price subscribed in MERGE mode.
  1. The first client, C1, subscribes to Item A and requires the snapshot.
  2. The Lightstreamer server knows nothing about of this Item and then to retrieve the current state asks the Data Adapter to provide the current value for last_price.
  3. The Data Adapter retrieves from the back-end, maybe stored in a DB, the current price for Item A, 15.99, and sends an update with the snapshot flag to true.
  4. The Lightstreamer server sends to C1 an update with last_price=15.99 but snapshot flag set to true so as to indicate that it is not a actual real-time update.
  5. The Data Adapter sends to Lightstreamer server all the updates received from the market feed for the last price of Item A, let's say, 16.02, 16.29 and then 16.23.
  6. The Lightstreamer server sends to C1 the updates with last_price=16.02, last_price=16.29, and then last_price=16.23 but snapshot flag set to false so as to indicate that they are actual real-time updates.
  7. Some time later a second client, C2, subscribes to Item A and requires the snapshot.
  8. The Lightstreamer server does not need to retrieve the snapshot from the Data Adapter because it is 16:23 (it knows already).
  9. The Lightstreamer server sends to C2 an update with last_price=16.23 but snapshot flag set to true so as to indicate that it is not a actual real-time update.
  10. The Data Adapter sends to Lightstreamer server a new update received from the market feed for the last price of Item A: 16.34.
  11. The Lightstreamer server sends to C1 and C2 the update with last_price=16.34 with the snapshot flag set to false so as to indicate that it is an actual real-time update.



The clearSnapshot should not be used to update the snapshot, but only to clear all the fields in the case their value has lost its meaning.
For example consider that the market has closed, and you do not want to publish anymore the value 16.34 as last_price.

Regards,
Giuseppe