-
October 1st, 2013, 10:12 AM
#1
Snapshot for subscribed items.
If there are no subscription for an item, the Lightstreamer Server does not hold any cached data for that item.
At the first subscription for an item, the Data Adapter ask to provide the snapshot.
For the subsequent subscriptions for the same item, the server does not ask anything, since it is receiving all the updates from the adapter and thus it has already the snapshot it has to send to the just subscribed client.
Is possible to change the behaviour for the subsequent subscriptions? I need to receive the snapshot for each subscription.
-
October 2nd, 2013, 09:13 AM
#2
Hi Atejero,
I confirm you that it is not possible to ensure that the Data Adapter sends the Snapshot for each new client that subscribes to a given Item.
The Snapshot should be considered as a set of fields that define the complete state of an item at a certain time.
So, against the first subscription for an Item the Lightstreamer server expects to be feeded with an initial Snapshot from the Data Adapter, and then in the face of real-time updates the server shall maintain an updated image of the Snapshot and make it available to any new clients that subscribe to that Item.
Please can you explain why the Snapshot provided by the server is not good for your client (than the first) needs?
Furthermore, please consider that if you want that your Adapters were notified for each client that subscribes to a particular Item you should use the notifyNewTables and wantsTablesNotification of Metadata Adapter Interface. And, if it is the case, you should let the Metadata comunicate with the Data Adapter.
-
October 3rd, 2013, 12:37 PM
#3
I want to implement a full order book for LSE instruments so I have a buy/sell orders table.
My application show the last received order and two tables one for buy orders and the other for sell orders.
When a client suscribe an instrument, I send a snapshot with the full order book as a string and then with javascript I fill the tables sorting by price.
Then I only receive orders and with javascript I repaint the tables.
But if a new client suscribe to the same instrument I dont receive the snapshot, I only receive the last order so I cant fill the tables.
-
October 3rd, 2013, 03:08 PM
#4
Hi atejero,
Are you using "MERGE" or "DISTINCT" mode, is that right?
Please consider the option to switch to "COMMAND" mode for your subscription. For example, in your case, you could create two Items for each instrument, "STOCK_A_BUY" and "STOCK_A_SELL".
These Items will be updated in your Adapter with "ADD", "DELETE" and "UPDATE" messages resulting from market orders and in agreement with the "COMMAND" subscription mode management. Please refer to section 3.1 of "general concepts" pdf.
When the first client subscribes to the Item, your Adapter has to push all the needed "ADD" updates as snapshot into the server. From now the Lighstreamer server will maintain a consistent snapshot of the Item and all subsequent clients will receive the snapshot as a list of complete orders.
Please, refer to this demo for an example of COMMAND mode.
HTH
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 07:20 AM.
Bookmarks