A simple portfolio demo application showing integration between the Dojo Toolkit and the Lightstreamer JS Client
Switch branches/tags
Nothing to show
Pull request Compare This branch is 37 commits behind Lightstreamer:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Lightstreamer :: Dojo Toolkit :: Portfolio Demo

A simple portfolio demo application showing integration between the Dojo Toolkit and the Lightstreamer JS Client. The demo shows how to use the Lightstreamer JS Client library, the lightstreamer-store, the dgrid component and DojoX Charts together.

Real-Time simulated Portfolio data is received from the Lightstreamer Server deployed @ http://push.lightstreamer.com

The demo can be seen online @ http://www.lightstreamer.com/demo/DojoDemo/portfolio.html. To deploy the demo on your own environment follow the below instructions.

Run The Demo

Before you can run the demo some dependencies need to be solved:

  • Get the lightstreamer_namespace.js file from the Lightstreamer 5 Colosseo distribution and put it in the src folder of the demo. Alternatively you can build a lightstreamer_namespace.js file from the online generator. In that case be sure to include the LightstreamerClient, Subscription and StatusWidget modules and to use the "AMD with namespaced names" version.
  • Download the Dojo Toolkit and copy the dojox folder from the package to the src folder of the demo. The demo requires the Dojo Toolkit v.1.8 or higher.
  • Using the CommonJS Package Manager install dgrid, dijit and lightstreamer-store in the src folder; dependencies for these packages will be automatically resolved by the cpm process: cpm install dgrid cpm install dijit cpm install lightstreamer-store

The demo is now ready to be launched: navigate to src/index.html and enjoy.

Deploy The Demo

Once the demo is working in your environment it is time to deploy it on a web server. Before doing so it is suggested to compress the dojo/dojox/dijit files in a single js source file to minimize startup times:

Head for the Dojo Web Builder and select the following packages:

  • dijit.layout.BorderContainer
  • dijit.Dialog
  • dijit.registry
  • dojox.charting.Chart
  • dojox.charting.StoreSeries
  • dojox.charting.axis2d.Default
  • dojox.charting.plot2d.Default
  • dojox.charting.themes.Claro
  • dijit.form.ToggleButton
  • dojo.store.Memory
  • dojo.store.Observable
  • dojo.parser
  • dojo.domReady
  • dijit.layout.ContentPane
  • dijit.form.Button
  • dojox.collections.Dictionary
  • dojox.collections.ArrayList
  • dojox.gfx.svg
  • dijit.form.NumberTextBox
  • dijit.form.CurrencyTextBox
  • dojo.number
  • dijit.form.NumberSpinner
  • dijit.form.FilteringSelect
  • dijit.form.Button
  • dijit.TitlePane

Then click the "build" button and wait. Once the builder is done a zip file will be dowloaded; copy the files/folders from the archive in the src/dojo foloder and reload the demo.

Point to your Lightstreamer

The demo currently connects to an online Lightstreamer demo server to get the stock data. It is possible to change this setting making the demo point to a different server. Obviously in this case the DEMO adapter needs to be installed on the tagert server (currently such adapter is installed by default). To change the server edit the index.js file and substitute the following line

var lsClient = new LightstreamerClient("http://push.lightstreamer.com","DEMO");


var lsClient = new LightstreamerClient(myServer,"DEMO");

where myServer contains the address of the server (comprehending the port if different from the default one). As an example, to connect to a local server listening on port 8080 use

var lsClient = new LightstreamerClient("http://localhost:8080","DEMO");