Lightstreamer - Stock-List Demo - Unity Client
(download UnityStockListDemo.zip; unzip it; launch UnityStockListDemo.exe)
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 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
Specifically, Lightstreamer connection information is defined inside
LightningBolt.cs (pushServerHost, items, fields).
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 firstname.lastname@example.org.
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.zipfile, which you can find in the deploy release of this project and extract the
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.
Assets/Lightning bolt.unitydouble 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
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
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 Adapters Needed by This Demo Client
- 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
Lightstreamer Compatibility Notes
- Compatible with Lightstreamer .NET Client API version 2.1 or newer.
- For Lightstreamer Allegro (+ .NET Client API support), Presto, Vivace.