Monday, October 18, 2010

Meta-Push, COMMAND Mode, and the New Flex Portfolio Demo

On of the advanced features of Lightstreamer that sometimes is not notice when first dealing with the product is COMMAND subscription mode. It is a very handy way of pushing not only changes to the data rows, but even changes to the table itself (in terms of adding and removing rows).

A typical example of this is a trading portfolio. You have a table with the list of stocks currently in your portfolio. The value of such stocks keep changing based on the market, so some columns keep being updated. At the same time, you may sell or buy some stocks, resulting in removing or adding rows to the table. You want such changes to be pushed to the front-end in real-time too. A nice example of this is the online Portfolio Demo.

This is what we call "meta-push". By using Lightstreamer's COMMAND mode, you can push commands to the client in order to add, delete, or update a row. The delivery of such commands over the wire is extremely optimized, with the auto-detection of redundant commands.

With meta-push, your Data Adapter needs to send the "add", "delete", and "update" commands. But there are cases where you need to decouple part of the update logic from the add/delete logic. For example, in the Portfolio mentioned above, it's easier to have one Data Adapter managing the changes in the portfolio, and another Data Adapter managing the updates to the prices coming from the market.

Lightstreamer enables this behavior by what we call "multi-meta-push". In this case, when the first Data Adapter pushes a command to add a new row, the client uses this information to automatically subscribe to an underlying item coming from the second Adapter. On the other hand, when a command to delete a row is received, the client automatically unsubscribes from the underlying item.

This powerful logic is implemented in the Lightstreamer Client libraries, thus removing the burden of handling that from the developers. There are many application scenarios where meta-push or multi-meta-push are very useful, even outside the financial area.