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.
(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
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.
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.
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 theUnityStockListDemo
folder. - Launch
UnityDemo.exe
(please note that the demo tries to connect to http://localhost:8080).
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.
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
.
- Lightstreamer - Stock- List Demo - Java Adapter
- Lightstreamer - Reusable Metadata Adapters- Java Adapter
- Lightstreamer - Stock-List Demos - HTML Clients
- Lightstreamer - Basic Stock-List Demo - jQuery (jqGrid) Client
- Lightstreamer - Stock-List Demo - Dojo Toolkit Client
- Lightstreamer - Basic Stock-List Demo - Java SE (Swing) Client
- Lightstreamer - Basic Stock-List Demo - .NET Client
- Lightstreamer - Stock-List Demos - Flex Clients
- Lightstreamer - Basic Stock-List Demo - Silverlight Client
- Lightstreamer - 3D World Demo - HTML (Three.js) Client
- Compatible with Lightstreamer .NET Client API version 2.1 to 4.0.