Skip to content

This project includes a demo client showing the integration between a modified version of the Lightstreamer .NET Client Library and the Unity 3D Development platform

Notifications You must be signed in to change notification settings

facybenbook/Lightstreamer-example-StockList-client-unity

 
 

Repository files navigation

Lightstreamer - Stock-List Demo - Unity Client

This project includes a demo client showing the integration between a modified version of the Lightstreamer .NET Client Library and the Unity 3D Development platform.

Live Demo

Demo ScreenShot

(download UnityStockListDemo.zip; unzip it; launch UnityStockListDemo.exe)

Please consider that this code is obsolete. For an up-to-date example of integration between Lightstreamer server and the Unity 2017 Development platform refer to this: Lightstreamer - Basic Demo - Unity Client

Details

At this time, Unity 3D support is experimental and some features may not work. Specifically, the Web Player build (the non-NaCL version) is known to not work. Moreover, the Android build fails as a result of errors in the original Unity 3D code.
This demo is a modified version of the official Unity [Procedural Examples] (https://www.assetstore.unity3d.com/#/content/5141) demo. In particular, the "Lightning Bolt" demo (Lightning Bolt.unity file) is the one containing the modified Lightstreamer .NET Client library code.

Dig the Code

The .NET code is located inside the Assets/Sources directory.
Specifically, Lightstreamer connection information is defined inside LightningBolt.cs (pushServerHost, items, fields). LightstreamerClient.cs, ILightstreamerListener.cs, StocklistConnectionListener.cs, and StocklistHandyTableListener.cs are the Lightstreamer bits in this demo.

  • StockListConnectionListener.cs: it's the Lightstreamer ConnectionListener implementation that is passed to LSClient for receiving connection-related events. In this project, this object routes all the events to ILightstreamerListener.
  • StocklistHandyTableListener.cs: it's the Lightstreamer HandyTableListener implementation that is passed to LSClient for receiving data-related events. In this project, this object routes all the events to ILightstreamerListener.
  • LightstreamerClient.cs: it's a wrapper class that encapsulates the Lightstreamer LSClient object, exposting start() and stop() methods.

Check out the sources for further explanations. The Lightstreamer Documentation is available at: http://www.lightstreamer.com/doc

NOTE: Not all the functionalities of the modified Lightstreamer .NET Client Library are exposed by the classes listed above. You can easily expand those functionalities using the Lightstreamer .NET Client API as a reference.

For any inquiry, please email support@lightstreamer.com.

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 has to be deployed on your local Lightstreamer Server instance. Please check out that project and follow the installation instructions provided with it.
  • Launch Lightstreamer Server.
  • Download the deploy.zip file, which you can find in the deploy release of this project and extract the UnityStockListDemo folder.
  • Launch UnityDemo.exe (please note that the demo tries to connect to http://localhost:8080).

Build

To build your own version of UnityDemo.exe, instead of using the one provided in the deploy.zip file from the Install section above, follow these steps:

  • The Unity 3D Development platform must be installed to build and run this demo. Download and Install Unity 3D from: http://unity3d.com/unity/download.
  • Clone this project: > git clone https://github.com/Lightstreamer/Lightstreamer-example-StockList-client-unity.
  • Open Assets/Lightning bolt.unity double clicking on it. The Unity Development Environment should open.
  • You can then Build & Run the "Lightning Bolt" project for Windows or MacOSX.

Running your own Lightstreamer Server

If you intend to change the pushServerHost variable inside LightningBolt.cs, pointing the demo to your own Lightstreamer Server, you are also required to run a Socket Policy Server on the same host, as explained at [Security Sandbox of the Webplayer] (http://unity3d.com/support/documentation/Manual/Security%20Sandbox.html)

Unity 3D provides a C# based Policy Server. However, a Java-based version of the Policy Server is provided with this demo and is available inside the SocketPolicyServer directory. To use the Java-based version of the Policy Server: compile it with command javac Sockpol.java and launch it with command java Sockpol cdpolicy.xml.

See Also

Lightstreamer Adapters Needed by This Demo Client

Related Projects

Lightstreamer Compatibility Notes

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

About

This project includes a demo client showing the integration between a modified version of the Lightstreamer .NET Client Library and the Unity 3D Development platform

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 86.3%
  • Java 7.6%
  • JavaScript 6.1%