Lightstreamer Server is correctly installed. This page contains some demo applications that you can run out of the box. Enjoy!
These demos, besides showing several aspects of Lightstreamer technology, can serve as a starting point to develop your own applications. Please consider that all of these demos work without an application server. In other words, they are so simple that they don't need any server-side logic, except for the Lightstreamer Adapters. Even the HTML front-ends are completely static (not generated through JSP, ASP, PHP, etc.). Real-world applications will usually include some server-side components, to manage the front-end generation and the application logic.
Check out more demos online at demos.lightstreamer.com
Pure HTML Clients
Monitor Console Demo >>
This application shows a real-time monitor console. Several metrics are reported as they change on the server.
NOTE: This is a demo application. The actual Monitor Console, which is intended for use by the Lightstreamer
Server administrators, is available by default from
/monitor/
(this can be configured in lightstreamer_conf.xml and proper credentials can be added).
Client Source Code
HTML/JavaScript: pages/demos/MonitorDemo
Subscriptions and Grids Involved:
Three StaticGrids containing the items and fields for the statistics, subscribed to in MERGE mode.
Fields from a single item are associated to cells scattered in the page.
Three DynaGrids for the three scrolling log pane items, subscribed to in DISTINCT mode.
Adapters Involved:
MONITOR: an internal Data Adapter that reports monitoring data on Lightstreamer Server itself.
Of course, other monitoring applications will need their own Data Adapter.
MonitorDemo: a simple Metadata Adapter that inherits from LiteralBasedProvider.
(*)
MonitorDemo Source Code
Java: DOCS-SDKs/sdk_adapter_java/examples/Monitor_MetadataAdapter
Basic Stock-List Demo >>
This application displays real-time market data for ten stocks, generated by a feed simulator.
The front-end code is kept extremely simple and represents a good
introduction to Lightstreamer table management. In particular, this code
can be considered a reference example of item subscriptions in MERGE mode.
Client Source Code
HTML/JavaScript: pages/demos/StockListDemo_Basic
Subscriptions and Grids Involved:
A StaticGrid containing 10 items, subscribed to in MERGE mode.
Adapters Involved:
QUOTE_ADAPTER: a sample Data Adapter that generates random market data.
QUOTE_ADAPTER Source Code
Java: DOCS-SDKs/sdk_adapter_java/examples/StockListDemo_DataAdapter
Java with JMS: DOCS-SDKs/sdk_adapter_java/examples/StockListDemo_JMS_DataAdapter
C#.NET: DOCS-SDKs/sdk_adapter_dotnet/examples/Remote_StockListDemo_Adapters/src_data_adapter
LiteralBasedProvider: a sample Metadata Adapter that can be used out-of-the-box for many types of applications.
(*)
LiteralBasedProvider Source Code
Java: DOCS-SDKs/sdk_adapter_java/examples/Reusable_MetadataAdapters/src_adapters
C#.NET: DOCS-SDKs/sdk_adapter_dotnet/examples/Remote_StockListDemo_Adapters/src_metadata_adapter
Stock-List Demo >>
With respect to the Basic Stock-List Demo, more features are demonstrated.
Click on the stock names to open pop-up windows that display real-time streaming charts. Notice that the maximum
update frequency set for the pop-up windows is greater than the frequency set for the main window. The data is resampled
by Lightstreamer Server according to the maximum frequency requested by each subscription (you can easily notice that if you open
"Ations Europe").
Click on the link under the table (Next/Previous 15) to dynamically switch between two lists of fifteen
items, without losing previously opened pop-ups. If you open the same demo in different browser windows, you will see slightly
different values for the most updated stocks. Again, this behavior shows how the data resampling is done in real-time on a per-window
basis.
Notice that a large portion of the JavaScript front-end code is devoted to client-side formatting operations.
Client Source Code
HTML/JavaScript: pages/demos/StockListDemo_Basic
Subscriptions and Grids Involved:
A DynaGrid containing up to 15 items, subscribed to in MERGE mode. Note that two Subscriptions are subscribed and
unsubscribed alternately according to the list of items to display.
A StaticGrid and a Chart for each pop-up window opened, feeded by the same Subscription containing
one item and subscribed to in MERGE mode.
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
Framed Stock-List Demo >>
The same as the Stock-List Demo, but with a different architecture for the LightstreamerClient integration.
The LightstreamerClient object is kept in a hidden Frame. For an explanation of the different deployment
strategies please refer to the "JavaScript Client Guide.pdf" document.
Client Source Code
HTML/JavaScript: pages/demos/StockListDemo_Frames
Subscriptions and Grids Involved:
A DynaGrid containing up to 15 items, subscribed to in MERGE mode.
A StaticGrid and a Chart for each pop-up window opened, feeded by the same Subscription containing
one item and subscribed to in MERGE mode.
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
Basic Portfolio Demo >>
In the Basic Portfolio Demo a virtual stock portfolio, shared among all the connected users, is displayed.
By using the "Submit Order" panel, you can buy or sell a stock (identified by an item number), filling
in the Quantity field and pressing the proper button.
The portfolio table is updated in push mode, for both the columns and the rows (this is the so called "metapush" feature).
Click on the column headers to sort the table on different columns.
This portfolio is shared among all the connected users, so you can connect to this demo from different machines
(or try at least different browsers on the same machine), then submit orders from one browser and see the updates
displayed on another browser.
The front-end code can be considered a reference example of item subscriptions in COMMAND mode.
Client Source Code
HTML/JavaScript: pages/demos/PortfolioDemo_Basic
Subscriptions and Grids Involved:
A DynaGrid containing one item, subscribed to in COMMAND mode.
Each row of the table is identified by a unique key. For didactic reasons, this example shows the
command and key fields, which are usually hidden.
Adapters Involved:
PORTFOLIO_ADAPTER: a sample Data Adapter that manages a simulated stock portfolio.
PortfolioMetadataAdapter: a simple Metadata Adapter that inherits from LiteralBasedProvider.
It plays the extra-role of receiving order submissions from the clients and forwarding them to the Data Adapter.
(*)
PORTFOLIO_ADAPTER and PortfolioMetadataAdapter Source Code
Java: DOCS-SDKs/sdk_adapter_java/examples/Portfolio_Adapters
C#.NET: DOCS-SDKs/sdk_adapter_dotnet/examples/Remote_Portfolio_Adapters/src_adapters, src_standalone_launcher
Portfolio Demo >>
This application extends the Basic Portfolio Demo by combining live stock prices (as in the Stock-List Demos) with
the portfolio contents.
The columns show: stock name, last price, quantity (number of stocks in the portfolio),
countervalue (=price*quantity), time of last price.
The portfolio content is the same as the Basic Portfolio Demo (i.e. it subscribes to the same item from the same Data Adapter)
and it is shared among all the connected users. Again, you can connect to this demo from different machines and see your
operations propagated everywhere.
The front-end code can be considered a reference example of item subscriptions in COMMAND mode with "two-level push".
Compared to the Basic Portfolio Demo a panel has been added to display information about the submission of orders.
The columns show: progressive number of order, stock name, type of order (buy or sell),
quantity, and status of order (SUBMITTING, PROCESSED, ABORT, DENY, DISCARDED, ERROR).
Client Source Code
HTML/JavaScript: pages/demos/PortfolioDemo
Subscriptions and Grids Involved:
A DynaGrid containing one item, subscribed to in COMMAND mode.
Each added row automatically provokes an underlying subscription to a sub-item in MERGE mode, to get the real-time price
for that specific stock from another feed (the same as in the Stock-List Demos).
When a row is deleted, the underlying sub-item is automatically unsubscribed from.
The order submission is done by sending a message directly to Lightstreamer Server using the
LightstreamerClient.sendMessage utility.
A DynaGrid is fed dynamically with one row for each sendMessage invocation and updated via
an appropriate ClientMessageListener.
Adapters Involved:
PORTFOLIO_ADAPTER (see Basic Portfolio Demo).
QUOTE_ADAPTER (see Basic Stock-List Demo).
PortfolioMetadataAdapter (see Basic Portfolio Demo).
Drop-Down Demo >>
This application shows a changeable list of items within a normal HTML drop-down menu. The contents of the
list change in real time, based on the commands pushed by the Server.
The feed that controls the list contents is the same as in the Portfolio Demos (i.e. it subscribes to the same item from
the same Data Adapter) and it is shared among all the connected users. So you can see the drop-down menu kept in sync
across all the browsers connected to this page.
The front-end code can be considered a reference example of item Subscriptions not associated to a visual Grid,
useful when the data visualization does not leverage the Lightstreamer widgets, but custom HTML or third-party widgets.
Client Source Code
HTML/JavaScript: pages/demos/DropDownDemo
Subscriptions and Grids Involved:
One item subscribed to in COMMAND mode, no visual object listening the subscription.
Each time the Server sends an add or delete command, the JavaScript code manipulates the drop-down menu
to update its contents.
Adapters Involved:
PORTFOLIO_ADAPTER (see Basic Portfolio Demo).
PortfolioMetadataAdapter (see Basic Portfolio Demo).
Basic Chat Demo >>
The Basic Chat Demo implements an extremely simple chat application, where all the users connected
to the page can exchange messages. Each message reports the originating IP address, together with
the user-agent string of the originating client, instead of leveraging a nick name.
Launch multiple instances of the demo, possibly on different machines, to appreciate the message broadcast capability.
The front-end code can be considered a reference example of item subscriptions in DISTINCT mode.
Client Source Code
HTML/JavaScript: pages/demos/ChatDemo
Subscriptions and Grids Involved:
A DynaGrid containing one item, subscribed to in DISTINCT mode.
Adapters Involved:
CHAT_ROOM: a sample Data Adapter that publishes messages on an item.
ChatMetadataAdapter: a simple Metadata Adapter that inherits from LiteralBasedProvider.
It plays the extra-role of receiving messages from the clients and forwarding them to the Data Adapter.
(*)
CHAT_ROOM and ChatMetadataAdapter Source Code
Java: DOCS-SDKs/sdk_adapter_java/examples/Chat_Adapters
Node.js: DOCS-SDKs/sdk_adapter_nodejs/examples/Remote_Chat_Adapters
Basic Instant Messenger Demo >>
The Basic Instant Messenger Demo shows a very simple version of a typical messenger, where messages can
be delivered to a specific friend, chosen from a dynamic list of online buddies.
Choose a nick-name and click Login. You will see a list of all users connected to this demo, with their
nicknames. Write a message and choose a recipient. The message will be delivered only to him/her (rather
than broadcasting it, as the Basic Chat Demo does).
Launch multiple instances of the demo, possibly on different machines, to populate the Buddies list.
If you use the same nick-name on different instances, you will actually embody the same identity
(to keep things simple, no authentication is used).
The front-end code can be considered a reference example of one-to-one messaging. Each user
subscribes to their personal item (corresponding to the nick-name), so that messages can be routed
properly, instead of begin broadcast (as in the Chat Demo, where all the users subscribe to the same
item). In real applications, where authentication is used, the Metadata Adapter should enforce the
association between the user's identity and the item they have the right to subscribe to.
Client Source Code
HTML/JavaScript: pages/demos/MessengerDemo
Subscriptions and Grids Involved:
A DynaGrid containing one item, subscribed to in DISTINCT mode, to get all
the personal messages.
A DynaGrid containing one item, subscribed to in COMMAND mode, to get
the updated buddy list.
Adapters Involved:
SIMPLE_MESSENGER: a sample Data Adapter that manages the personal users' items and
the item dedicated to the buddy list.
IMMetadataAdapter: a simple Metadata Adapter that inherits from LiteralBasedProvider.
It plays the extra-role of receiving messages from the clients and forwarding them to the Data Adapter.
(*)
SIMPLE_MESSENGER and IMMetadataAdapter Source Code
Java: DOCS-SDKs/sdk_adapter_java/examples/Messenger_Adapters
Flash & Flex Clients
Basic Flash Bridge Demo >>
This very simple demo uses the Flash Bridge to inject real-time data into two Flash movies
hosted on the page. Each of the two movies subscribes to two items of the Stock-List Demos.
The smaller sets a maximum update frequency of 1 event/sec.
Client Source Code
HTML/JavaScript part: pages/demos/Flash_StockListDemo_Basic
Flash part: DOCS-SDKs/sdk_client_flash/examples/FlashBasic
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
Flash Bridge :: Stock-List Demo >>
This is a Flash version of the Stock-List Demo, which displays eight stock quotes with some graphical effects.
Client Source Code
HTML/JavaScript part: pages/demos/Flash_StockListDemo
Flash part: DOCS-SDKs/sdk_client_flash/examples/FlashStockList
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
Flex :: Stock-List Demo >>
[NOTE: Flex clients are only supported by Lightstreamer Presto and Vivace, and not by Lightstreamer Allegro]
This is a Flex version of the Stock-List Demo, where ten items are subscribed to.
The upper table shows the automatic binding of a Lightstreamer data table to a Flex widget (a Grid).
You can sort on any columns and drag the columns around. The buttons to the right control the update
highlight effects and can stop/start the subscription.
The lower table shows the direct use of pushed values to manually update a Flex widget (a TextArea).
The buttons to the right can clear the TextArea and stop/start the subscription.
Client Source Code
Flex 4: DOCS-SDKs/sdk_client_flex/examples/Flex4StockListDemo
For instructions on deploying the Flex Demo on an external Web Server, please see README.TXT in the
source code folder.
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
Flex :: Portfolio Demo >>
[NOTE: Flex clients are only supported by Lightstreamer Presto and Vivace, and not by Lightstreamer Allegro]
This is a Flex version of the Portfolio Demo.
The left table shows the automatic binding of a Lightstreamer data table configured to exploit "two-level push" to a Flex widget (a Grid).
You can sort on any columns and drag the columns around. Using the form to the right, you can buy or sell a stock.
Clicking the "Random Orders" button, 20 random orders are placed in batch mode.
The second Grid, below the orders form, mantains a list of executed orders and their statuses (PROCESSING, PROCESSED, ABORTED or ERROR).
Such statuses are received by the demo code by listening for SendMessageAbortEvent, SendMessageErrorEvent, and SendMessageProcessedEvent events.
The statuses are then placed in an ArrayCollection that is in turn bound to the DataGrid.
Client Source Code
Flex 4: DOCS-SDKs/sdk_client_flex/examples/Flex4PortfolioDemo
For instructions on deploying the Flex Portfolio Demo on an external Web Server, please see README.TXT in the
source code folder.
Adapters Involved:
PORTFOLIO_ADAPTER (see Basic Portfolio Demo).
QUOTE_ADAPTER (see Basic Stock-List Demo).
PortfolioMetadataAdapter (see Basic Portfolio Demo).
Silverlight Clients
Silverlight :: Stock-List Demo >>
[NOTE: Silverlight clients are only supported by Lightstreamer Presto and Vivace, and not by Lightstreamer Allegro]
This is a Silverlight version of the Stock-List Demo, where thirty items are subscribed to.
After launching the demo, wait for the "Lightstreamer is pushing..." message to appear,
then click the "Subscribe" button to start the data push.
A Silverlight Grid is used to display the real-time data.
You can sort on any columns and drag the columns around (in this demo the resorting is not done
automatically on each update).
Client Source Code
Silverlight: DOCS-SDKs/sdk_client_silverlight/examples/SilverlightStockListDemo
For instructions on deploying the Silverlight Demo on an external Web Server, please see README.TXT in the
source code folder.
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
Other Clients
Other sample client applications are available for different technologies. You can check out the following folders:
Node.js Client :: Stock-List Demo
JavaScript: DOCS-SDKs/sdk_client_javascript/examples/NodejsDemo
.NET Client :: Stock-List Demo
C#: DOCS-SDKs/sdk_client_dotnet/examples/DotNetClientStockListDemo
Java SE Client :: Test
Java: DOCS-SDKs/sdk_client_java_se/examples/ls_client
Java SE Client :: Swing Stock-List Demo
Java: DOCS-SDKs/sdk_client_java_se/examples/Swing_StockListDemo
Blackberry Client :: Stock & Round-Trip Midlet
Java - BlackBerry: DOCS-SDKs/sdk_client_blackberry/examples/StockList_Interaction_BlackBerry
Java ME Client :: Stock & Round-Trip Midlet
Java - MIDP 2: DOCS-SDKs/sdk_client_java_me/examples/StockList_Interaction_Midlet
AIR Client :: Stock-List Demo
Flex 4: DOCS-SDKs/sdk_client_flex/examples/AIR4StockListDemo
Android Client :: Stock-List Demo
Java: DOCS-SDKs/sdk_client_android/examples/Android_StockListDemo
iOS Client :: Stock-List Demo
Objective-C: DOCS-SDKs/sdk_client_ios/examples/iOS_StockListDemo
OS X Client :: Stock-List Demo
Objective-C: DOCS-SDKs/sdk_client_osx/examples/OS_X_StockListDemo
Windows Phone Client :: Stock-List Demo
C#: DOCS-SDKs/sdk_client_windows_phone/examples/WindowsPhone_StockListDemo
[NOTE: Most of these clients are only supported by Lightstreamer Presto and Vivace, and not by Lightstreamer Allegro]
Footnotes