Hi Lidan
Yes, the client is not able to subscribe only Create or Delete messages but not Updates, so, in order to actually avoid to send Update messages to a client not interested to them, you have to act on the Adapter. Otherwise the client may ignore the Update messages, but this means the messages are still sent and thus use network bandwidth.
From the Adapter point of view there are three possible solutions I can think of.
The first proposed solution is based on the "two-level push" (you may take a look at the Portfolio Demo at
http://www.lightstreamer.com/demos#PortfolioDemo for an example).
In this case there are actually two distinct Data Providers: one that sends Add or Remove commands for items being added or removed from a basket, carrying the item key and static field, and the other actually sending the volatile fields, thus sending update messages when an item changes.
If a client is not interested at receiving updated values, but it's just interested at receiving a message when an item has been added or removed, it may subscribe only to the first Data Adapter.
The second proposed solution involves the use of a Selector. The Client can specify a selector through the setSelector() function and the Metadata Adapter decides whether an event should be delivered to that session based on the specified selectior string.
You have to extend the Metadata Adapter, implementing the 'isSelectorAllowed' and 'isSelected' methods.
In this case Items can be selected based on the "command" filed of the ItemEvent. Note that it's up to the selector to ensure the suppression of events is "consistent with keys lifecycle,
ensuring that ADDs and DELETEs on the same key are interlaced (always starting with an ADD, if the snapshot has been requested) and that UPDATEs follow ADDs for the same key, but not DELETEs". For more details you may look at chapter 3.3.1 in "Lightstreamer General Concepts"
http://www.lightstreamer.com/latest/Lightstreamer_Allegro-Presto-Vivace_5_1_Colosseo/Lightstreamer/DOCS-SDKs/General%20Concepts.pdfand on the forum at
http://forums.lightstreamer.com/showthread.php?65-Using-selectors .
The third proposal is to duplicate the items: for a given item the client may subscribe to a key where all commands are sent, or it may subscribe to an other key where only Create and Delete are sent. In other words, if an item is added on or delete from the Data Provider, the Data Adapter actually sends the command with two different topics, while instead, if an item is updated on the Data Provider, the Data Adapter sends the Update message only for one topic.
This is not actually very elegant but it's simple.
HTH
Marco