Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Lightstreamer - Quickstart Example - .NET Client

The Quickstart Example provides the source code to build a very simple and basic client application, used to test the capability of the Client APIs to connect and receive data from Lightstreamer Server. The example can be used to familiarize with the Client APIs and as a reference on how to use them, and can be used as a starting point for client application implementations.

This project contains the C# source files of a sample application, which shows how the Lightstreamer .NET Standard Client API can be used to connect to Lightstreamer Server. The Client API version in use in this example support the Unified Client API model (since Lightstreamer .NET Standard API 5.0.0).



The example basically connects to the server and performs a subscription, printing on the console the incoming Item Updates. Some connection parameters and the type of subscription performed depend on the parameters passed in the command line; which in the right order are:

  • HOST: the complete hostname of the Lightstreamer server to target. For example to hit our Demos server use
  • MODE: should be
    • 0 for Stock-List subscription targeting the QUOTE_ADAPTER Data Adapter
    • 1 for Chat subscription targeting the CHAT_ROOM Data Adapter
    • 2 for Portfolio subscription targeting the PORTFOLIO_ADAPTER Data Adapter
  • [MAX_FREQUENCY]: double value in oreder to request to the Lightstreamer server a max frequency (optional)
  • [FORCE_TRANSPORT]: could be WS-STREAMING, HTTP-STREAMING, WS-POLLING, or HTTP-POLLING. If no value passed the STREAM-SENSE algorithm of the Lightstreamer client lib will set-up the connection with the best transport available (optional)
  • [PROXY_ON: 0/1] to use or not to use a http proxy (optional)
  • [PROXY_ADDRESS]: in the case, the ip address of the http proxy (optional)
  • [PROXY_PORT]: in the case, the port to connect the http proxy (optional)

Dig the Code

The application is divided into 6 main classes.

  • QuickStart.cs: this is the main class, implementing the connection to the Lightstreamer server, the subscription of Items and in case of Chat mode the send of text messages.
  • SystemOutClientListener.cs: is a very basic custom implementation of the ClientListener interface. An instance of this class, listening to a LightstreamerClient instance (through the addListener method) will print on the standard output information about the status of the connection and will trigger the subscription request upon the status change event indicating the client session is alive.
  • QuoteListener.cs, PortfolioListener.cs, and ChatSubscriptionListener.cs: are very basic custom implementations of the SubscriptionListener interface. Basically just print on the console every event received.
  • Log4NetLoggerWrapper.cs: this is a wrapper class to allow the client library to log through NLog.


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

  • you'll need to install the following adapters (depending on which quickstart example you want to run you might not need them all):
  • 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 a version of this example, pointing to your local Lightstreamer Server instance, follow the steps below.

  • Exactly as in the previous section, you should install in your Lightstreamer server the CHAT_ROOM or the PORTFOLIO_ADAPTER or the QUOTE_ADAPTER. If you want to skip the Adapters installation you could target our Demos server (
  • 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.
  • As in the previous steps add to your project also the reference to NLog.
  • Build solutions and run the demo.

See Also

Lightstreamer Adapters Needed by These Clients

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.


The provided source code can be used as a starting point to familiarize with the Lightstreamer .Net Client API




No packages published

Contributors 4