Lightstreamer - Basic Stock-List Demo - HTML (GWT) Client
This page uses the Web Client SDK 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 Web SDK 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.
Check out the sources for further explanations.
NOTE: Not all the functionalities of the Lightstreamer Web Client SDK API are exposed by LSGWTLightstreamerClient and LSGWTSubscription. You can easily expand those functionalities using the Web Client API as a reference.
If in trouble, check out the specific Lightstreamer forum.
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 that you can find in the deploy release of this project and extract the
- Deploy the
GWT_StockListDemo_Basic.wararchive in your favorite Web Server. We tested it with Apache Tomcat 7.0 by just copying the .war under the
- 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).
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://code.google.com/webtoolkit/ and follow the instructions to install the plugin in eclipse. (Hint, this is the update site you need: http://dl.google.com/eclipse/plugin/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 Lightstreamer server 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 Web Client SDK API library.
You can build the lib from the provided generator and copy the file into this folder with the
see the build instructions on the GitHub page.
Please be sure to include all the classes available.
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.
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 Compatibility Notes
Compatible with Lightstreamer Web Client library version 8.0 or newer.
For a version of this example compatible with Lightstreamer SDK for Web Clients version 7.x or earlier, please refer to this tag.