The provided source code can be used as a reference for subscriptions in COMMAND mode with "two-level push" with the Lightstreamer .NET PCL Client API
C#
Latest commit e110d45 Jan 23, 2017 @Bravo27 Bravo27 Swotch to PCL client lib
Permalink
Failed to load latest commit information.
sources
.gitattributes
.gitignore
LICENSE
README.md
screen_large.jpg
screen_large.png
screen_small.png

README.md

Lightstreamer - Portfolio Demo - .NET Client

This project contains a very simple implementation of the Portfolio Demo which shows how the Lightstreamer .NET PCL Client API can be used to implement item subscriptions in COMMAND mode with "two-level push".

More details about COMMAND mode subscriptions and "two-level push" in section "3.2.3 COMMAND Mode" of the General Concepts.pdf documentation.

Details

screenshot

View live demo

(download deploy_push.zip; unzip it; double click on "LaunchMe" shortcut)

In the Basic Portfolio Demo, a virtual stock portfolio, shared among all the connected users, is handled. This demo application extends the Basic Portfolio Demo by combining live stock prices, StockList Data Adapter, as in the Stock-List Demos with the portfolio contents, Portfolio Data Adapter. The updates are printed on the console and the columns show are: stock name, last price, quantity (number of stocks in the portfolio), countervalue (=price*quantity);

The Code

In particular, the code that handles the two level subscriptions is located in the TestPortfolioListenerForExtended class (TestTableListener.cs), while the Portfolio class (Portfolio.cs) simply assembles the information from the first and second level subscriptions. The sample program logs updates and general messages on the console.

Install

If you want to install a version of this demo pointing to your local Lightstreamer Server, follow these steps:

Build

To build and install a version of this demo, pointing to your local Lightstreamer Server instance, follow the steps below.

  • Exactly as in the previous section, both the PORTFOLIO_ADAPTER (see the Lightstreamer - Portfolio Demo - Java Adapter), and the QUOTE_ADAPTER (see the Lightstreamer - Stock-List Demo - Java Adapter) are a prerequisite. The full version of the Lightstreamer - Portfolio Demo - Java Adapter has to be deployed on your local Lightstreamer Server instance. Please follow the instruction in Install the Portfolio Demo to install it.
  • Create a new C# project: from the "New Project..." wizard, choose the "Console Application" template.
  • Add all the files provided in the sources folder of this project; from the "Add -> Existing Item" dialog.
  • From the "Solution Explorer", delete the default Program.cs.
  • You should complete this project with the Lightstreamer .NET PCL Client library, to be used for the build process, trough NuGet. Follow these steps:
    • In the "Solution Explorer" tab, right click on the project and choose Manage NuGet Packages ...
    • In the Search text box enter Lightstreamer
    • Choose Lightstreamer.DotNet.Client then click Install and then Ok
    • Check out that among the References of your project Lightstreamer_DotNet_PCL_Client was added.
  • Build solutions and run the demo. The host name and the port number of the Lightstreamer server have to be passed to the application as command line arguments.

See Also

Lightstreamer Adapters Needed by This Client

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer .NET PCL Client library version 3.0.0 or newer.
  • For Lightstreamer Allegro (+ .NET Client API support), Presto, Vivace.