Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 3.84 KB

README.md

File metadata and controls

76 lines (57 loc) · 3.84 KB

Lightstreamer :: Dojo Toolkit :: Stock-List Demo

A simple stocklist 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 Stock-List data is received from the Lightstreamer Server deployed @ http://push.lightstreamer.com

The demo can be seen online @ http://www.lightstreamer.com/demo/DojoDemo. 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

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");

with

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");