Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

README.md

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". This example uses a library version that support the Unified Client API model (since Lightstreamer .NET Standard API 5.0.0) and therefore the explicit management of the second level of the COMMAND subscription mode.

You can find 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, time of the last price, quantity (number of stocks in the portfolio), and countervalue (calculated in the client application: price*quantity).

The Code

The Program.cs source code file describes the main flow of the application, very simple, which involves the following sequence:

  • creation of a LightstreamerClient instance;
  • add a custom implmentation of ClientListener interface described in the TestConnectionListener.cs source code file;
  • call connect() method trying to set up a client session with the specified server;
  • wait for client session go active;
  • creation of a Subscription containing 1 item, subscribed to in COMMAND mode. Each added row automatically provokes an underlying subscription to a sub-item in MERGE mode, to get the real-time price for that specific stock from another feed (the same as the Stock-List Demos). When a row is deleted, the underlying sub-item is automatically unsubscribed from.
  • add a custom implementation of SubscriptionListener interface described in the SystemOutSubscriptionListener.cs source code file.

Install

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 deploy.zip file that you can find in the deploy release of this project and extract the deploy_local folder.
  • Execute the LaunchMe.bat.

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 ".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 the Lightstreamer.DotNetStandard.Client last version then click Install and then Ok
    • Check out that among the References of your project Lightstreamer_DotNet_Client_Unified 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 5.0.0 or newer.
  • For instructions compatible with .NET Standard Client library version 4.x, please refer to this tag.
  • Ensure that .NET Standard Client API is supported by Lightstreamer Server license configuration.

About

The provided source code can be used as a reference for subscriptions in COMMAND mode with "two-level push" with the Lightstreamer .NET Standard Client API

Resources

License

Packages

No packages published

Languages