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
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Lightstreamer - Portfolio Demo - .NET Client

This project contains a very simple .NET Core console application implementing the Portfolio Demo which shows how the Lightstreamer .NET Standard 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.



View live demo

(download; 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.


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

  • Note that, as prerequisite, the Lightstreamer - Stock- List Demo - Java Adapter and the Lightstreamer - Portfolio Demo - Java Adapter have to be deployed on your local Lightstreamer Server instance. Please check out those projects and follow the installation instructions provided with them.
  • Since the app is an example of Framework-Dependent Deployment (FDD) relies on the presence of a shared system-wide version of .NET Core on the target system.
  • Launch Lightstreamer Server.
  • Download the file that you can find in the deploy release of this project and extract the deploy_local folder.
  • Execute the LaunchMe.bat.


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 ".NET Core" and then "App Console" template.
  • From the "Solution Explorer", delete the default Program.cs.
  • Add all the files provided in the sources folder of this project; from the "Add -> Existing Item" dialog.
  • You should complete this project with the Lightstreamer .NET Standard 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.DotNetStandard.Client then click Install and then Ok
    • Check out that among the References of your project Lightstreamer_DotNet_Standard_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 Standard Client library version 4.0.0 or newer.
  • Ensure that .NET Standard Client API is supported by Lightstreamer Server license configuration.