This project contains a demo client showing integration between the Lightstreamer JavaScript Client API library and Google Web Toolkit (GWT)
Java HTML CSS
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
src
war
.classpath
.gitattributes
.gitignore
.project
LICENSE
README.md
screen_gwt.png
screen_gwt_large.png

README.md

Lightstreamer - Basic Stock-List Demo - HTML (GWT) Client

This project contains a demo client showing integration between the Lightstreamer JavaScript Client API and Google Web Toolkit (GWT).

Live Demo

Demo ScreenShot

View live demo

Details

This page uses the JavaScript Client API for Lightstreamer to handle the communications with Lightstreamer Server and uses a GWT FlexTable to display the real-time data pushed by Lightstreamer.

The demo includes the following client-side functionalities:

  • A Subscription containing 10 items, subscribed to in MERGE mode.

Dig the Code

Some binding are made to the html page (war/GWT_StockListDemo_Basic.html) to let the demo work:

  • The Lightstreamer JavaScript API Client library is included in the page.
  • A "lsGwtDynamic" div element is added to the page; this will be the place where the GWT FlexTable will be appended.

The LSGWTLightstreamerClient class wraps the LightstreamerClient object, which is the JavaScript class responsible of handling the connections and subscriptions to the Lightstreamer server.
The LSGWTSubscription class wraps the Subscription JavaScript class, which represents a Lightstreamer subscription. It is an abstract class; its subclass LSGWTDemoTable extends its functionalities, implementing the handling of the updates and publishing them to a GWT FlexTable.

Check out the sources for further explanations.

NOTE: Not all the functionalities of the Lightstreamer JavaScript Client API are exposed by LSGWTLightstreamerClient and LSGWTSubscription. You can easily expand those functionalities using the JavaScript Client API as a reference.
If in trouble, check out the Lightstreamer forum.

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 that you can find in the deploy release of this project and extract the GWT_StockListDemo_Basic.war package.
  • Deploy the GWT_StockListDemo_Basic.war archive in your favorite Web Server. We tested it with Apache Tomcat 8.0 by just copying the .war under the webapps folder.
  • From your favorite browser, open http://localhost:9090/GWT_StockListDemo_Basic/ (obviously, this applies if the web server responds to http://localhost:9090/, otherwise, change it accordingly).

Build

To build your own version of GWT_StockListDemo_Basic.war, instead of using the one provided in the deploy.zip file from the Install section above, or just to run the demo with your IDE, follow these steps:

Before you can run the demo, some dependencies need to be solved. Please follow the instructions below, otherwise you can run an online demonstration hosted on our servers here.
To directly import the project as-is, you need the Eclipse IDE with the GWT plugin installed, go to http://www.eclipse.org/ and download the latest eclipse distribution in its "classic" package.

Go to http://www.gwtproject.org/download.html and follow the instructions to install the plugin in eclipse. (Hint, this is the update site you need: https://developers.google.com/eclipse/docs/install-eclipse-x.x where x.x is the eclipse version you have; e.g. 3.6).

NOTE: You may also use the sources included in this project with another IDE or without any IDE but such approach is not covered in this readme. In any case, you need at least the GWT SDK.

Obviously, you also need to have the Lightstreamer 5.0 Colosseo server or newer installed somewhere. If you don't have it, go download it here: http://www.lightstreamer.com/download and follow the instructions in the package to install it.

The next step is to complete your installation of the demo with a valid version of the Lightstreamer JavaScript Client API library. You can get the lib from the online generator and copy the file into this folder with the lightstreamer.js name. Please be sure to include all the classes available and to flag the "Use namespaced globals" option.
You're now ready to import the project into Eclipse. Click on File->Import... then under General, select Existing Projects into Workspace and choose the folder where you've exported this project.

Configure the Demo

Before you start, only if you have changed the server configuration, open the src/gwtdemo/client/lsconfig.properties file contained in this zip and change the host and port settings according to your environment (port is the port the Lightstreamer server is listening on).

Compile and Run

From Eclipse, to compile the application, right-click on the project in the Package Explorer and click Google->GWT Compile; you may want or need to change the configuration of the build; at the moment, it is configured to be as fast as possible.

Once compiled, you have to start the servlet container (the Eclipse plugin ships with a Jetty installation): right click again on the project and select Debug As -> Web Application. Once started, a Development Mode view will appear containing a URL to be pasted on your browser. It will look like this: "http://127.0.0.1:8888/GWT_StockListDemo_Basic.html?gwt.codesvr=127.0.0.1:9997" NOTE: do not use that URL as is but remove the ?gwt.codesvr=127.0.0.1:9997 and use this: "http://127.0.0.1:8888/GWT_StockListDemo_Basic.html".

NOTE: In case of trouble reaching the server, you may need to edit the debug configuration; click on Run->Debug Configurations, select the configuration generated by the previous clicks, and edit the Arguments tab adding -bindAddress 0.0.0.0 to the program arguments.

See Also

Lightstreamer Adapters Needed by This Demo Client

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer JavaScript Client library version 6.0 or newer.