Results 1 to 9 of 9
  1. #1

    Question Snapshot is a flag or value?

    Please help me explain to it, make me confuse a lot.
    In a lot of your example, i saw when feed simulator generate new value and call OnEvent(), isSnapshot always true, I understand because it is real-time data,
    But in case first client subscribed, feed simulator still generate new value and send to it. In some real project, it get last value from database and set isSnapshot to true.
    So I want to ask. snapshot is value ? If it is value, where I can access it ? And why we not send directly snapshot, instead get from 3rd like database. My LS server always in running.
    In case 2nd client subscribed same item with first client and request snapshot, MERGE MODE, current itemUpdate of item1 will be sent to client 2 with tag snapshot=true ? Or with distinct mode, current items in itemeventbuffer will be sent with tag ? instead cached value and make it as snapshot value and send ?
    And, I saw we can set tag when sent, in case I got old value but set snapshot to false and send, it still valid ? From client or another side, how to check that ?
    Thanks for support. <3
    Last edited by chickendev; January 4th, 2023 at 08:01 AM.

  2. #2
    Another question, if we can set isSnapshot when updateEvent. What is the real role of the Preprocessor when processing Snapshots?

  3. #3
    And, if I don't have any client subscribe before, no data base, no default value. After reinstall lightstreamer & restart server, first client request snapshot, it can receive snapshot data ? in this case, I want to ask, where these data come from ?

  4. #4
    In case my client not request initial snapshot value. From server side, in DataAdapter, subscribe function not support sendSnapshot value & IsSnapshotAvailable func return false. Why my client cant receive any update after end of snapshot trigger ?

  5. #5
    Join Date
    Feb 2012
    Hi chickendev,

    First of all let me clarify that isSnaphot is a flag, which is used to identify an event as a snapshot and differentiate it from all others which are considered real-time events.
    But please let me clarify that it is necessary to differentiate the behavior into two distinct phases:

    1. the relationship between the Lightstreamer server and the Data Adapter
    2. the relationship between a client and the Lightstreamer server

    In 1. for each Item subscribed the Lightstreamer server asks the Data Adapter whether it has to wait for a snapshot image for that Item.
    This is by the isSnapshotAvailable method of the DataProvider interface.
    If the Data Adapter reply is true, the Lightstreamer server expects to receive, before the normal real-time events, one or more events (depending on the subscription mode) with the isSnapshot flag set to true followed by an endOfSnapshot event.
    If the Data Adapter replies false, the Data Adapter can start pushing real-time events right away.

    Regardless of what happened in 1.; phase 2. it's about client subscriptions and in particular if the setRequestedSnapshot is leveraged or not.
    If the requestedSnapshot is set to no, the client will receive only real-time updates as soon as Data Adapter pushes them into the Lightstreamer server.
    If the requestedSnapshot is set to yes, the Lightstreamer server will send previously any real-time updates one or more updates marked as snapshot that can be followed by the EndOfSnaphsot event depending on the subscription mode.
    Only in the case this is the first client subscribing to the specific Item and the Data Adapter reply true to isSnapshotAvailable, then the Lightstreamer server waits for any data from the data provider.
    In all other cases, the response to the snapshot request from the clients is based on the image that the Lightstreamer server keeps in the internal buffer.
    For example for Items subscribed in MERGE mode the snapshot image used by the server is composed by the last value received from the Data Adapter for each field.

    Also keep in mind that both the Data Adapter (towards the Lightstreamer server) and the Lightstreamer server (towards a client) if do not have information about the snapshot, they can immediately send an EndOfSnapshot event, just to inform that in this case the snapshot is empty.

    Please let us know if you need any further clarifications.


  6. #6
    Thanks for reply, another question, sry:
    In 1, you said that: If the Data Adapter replies false, the Data Adapter can start pushing real-time events right away.
    But from client, I got Keep Alive ping only ? What problems here ?
    I am using Lightstreamer-example-StockList-adapter-dotnet get from your Github
    with some modify in src/src_data_adapter/StockList.cs:
    - Line 79 to: // _myFeed.SendCurrentValues(itemName);
    - Line 106 to: return false;

  7. #7
    Join Date
    Feb 2012
    Hi chickendev,

    Yes, if for a client session there are no real-time updates to send and after a configurable timeout no updates have been sent, then a small keep-alive message is sent.
    The timeout can be configured both client-side and server-side.
    For the server-side please refer to <default_keepalive_millis>, <min_keepalive_millis>, and <max_keepalive_millis> in the lightstreamer_conf.xml configuration file.
    For the client-side refer to the API:

    For a better control of the connection status, and to allow the server to detect a possible disconnection by the client as soon as possible, it is also possible to activate the reverse heartbeats (sent by the client to the server):


  8. #8
    Thanks for reply, but I want to ask, why my client cant receive real-time data ? Because from server sides my FeedSimulator still working and update data. What problems here. Again, I am using Lightstreamer-example-StockList-adapter-dotnet get from your Github
    with some modify in src/src_data_adapter/StockList.cs:
    - Line 79 to: // _myFeed.SendCurrentValues(itemName);
    - Line 106 to: return false;

  9. #9
    Join Date
    Feb 2012
    Hi chickendev,

    So your problem is that you have changed the Data Adapter code, such that it no longer provides the snapshot, but then you also no longer receive the normal real-time updates?
    First, your changes to remove the snapshot management from the Data Adapter seem correct to me.

    Let me recap what the scenario should look like in your case:

    1. a client subscribes for the first time an item of the StockList demo, let's say item1;
    2. the Lightstreamer server receives the subscribe request and asks the Data Adapter for the snapshot;
    3. the Data Adapter reply false to IsSnapshotAvailable
    4. the Lightstreamer server dispatches an EndOfSnapshot event to the client
    5. when the ExternalFeedProducer of the adapter produces a new update for item1 the Data Adapter pushes it into the Lightstreamer server
    6. the Lightstreamer server sends the update to the client, unless it is filtered for some reason (that can be either an exceeding of the frequency limit imposed for that client or the outgoing queue for that client is full).

    Then 5. and 6. repeat until the client unsubscribes item1.

    Now it is necessary to understand in your case what is actually missing if only point 6. or also points 4. and 5.
    Please could you reproduce the issue after changing these log settings (lightstreamer_log_conf.xml):

    <logger name="LightstreamerLogger.requests" level="INFO"/>
    <logger name="LightstreamerLogger.subscriptions" level="DEBUG"/>
    <logger name="LightstreamerLogger.subscriptions.upd" level="DEBUG"/>
    <logger name="LightstreamerLogger.pump" level="DEBUG"/>

    then the lightstreamer.log should provide useful information to understand what is going wrong.




Similar Threads

  1. Replies: 1
    Last Post: April 17th, 2015, 09:59 AM
  2. Replies: 4
    Last Post: September 24th, 2013, 09:28 AM
  3. Replies: 2
    Last Post: March 19th, 2008, 10:19 AM
  4. VisualTable = How to capture value?
    By bayu in forum Client SDKs
    Replies: 1
    Last Post: December 17th, 2007, 10:14 AM
  5. Pre-Processor Snapshot vs DataAdapter Snapshot
    By sukhdev in forum Adapter SDKs
    Replies: 3
    Last Post: August 1st, 2007, 08:44 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT +1. The time now is 03:11 AM.