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.
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
Tables Involved:
Three OverwriteTables containing the items for the statistics, subscribed to in MERGE mode.
Fields from a single item are associated to cells scattered in the page.
Three DynaScrollTables 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
Tables Involved:
An OverwriteTable 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/DotNetStockListDemo/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/DotNetStockListDemo/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 table (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. Agais, 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
Tables Involved:
An OverwriteTable containing 15 items, subscribed to in MERGE mode.
An OverwriteTable and a ChartTable for each pop-up window opened, containing
one item, 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 LightstreamerEngine integration.
The LightstreamerEngine object is kept in a hidden Master Push-Page. For an explanation of the different deployment
strategies please refer to the "Web Client Dev.pdf" document.
Client Source Code
HTML/JavaScript: pages/demos/StockListDemo_Frames
Tables Involved:
An OverwriteTable containing 15 items, subscribed to in MERGE mode.
An OverwriteTable and a ChartTable for each pop-up window opened, containing
one item, 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 rows (this 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.
Please notice that the order submission is done by sending a message to Lightstreamer Server directly.
Real applications will usually deliver messages to an application server, which will process them and in
turn send them to the proper Lightstreamer Adapters through some messaging
middleware (e.g. JMS, RV, etc.).
Client Source Code
HTML/JavaScript: pages/demos/PortfolioDemo_Basic
Tables Involved:
A DynaMetapushTable 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
>> 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".
The same considerations on order submissions as for the Basic Portfolio Demo apply.
Client Source Code
HTML/JavaScript: pages/demos/PortfolioDemo
Tables Involved:
A MultiDynaMetapushTable 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.
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 through non-visual tables,
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
Tables Involved:
A NonVisualTable containing one item, subscribed to in COMMAND mode.
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.
As for the Portfolio Demos, to keep the example simple and deployable without a web/application server,
the message submission is done by sending a message to Lightstreamer Server directly.
Client Source Code
HTML/JavaScript: pages/demos/ChatDemo
Tables Involved:
A DynaScrollTable 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
>> 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.
The same considerations on message submission as in the Basic Chat Demo apply.
Client Source Code
HTML/JavaScript: pages/demos/MessengerDemo
Tables Involved:
A DynaScrollTable containing one item, subscribed to in DISTINCT mode, to get all
the personal messages.
A DynaMetaPushTable 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/FlashBridgeBasicDemo
Flash part: DOCS-SDKs/sdk_client_flash_flex(js_bridge)/examples/FlashBasic
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
>> Flash Bridge 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/FlashBridgeStockListDemo
Flash part: DOCS-SDKs/sdk_client_flash_flex(js_bridge)/examples/FlashStockList
Adapters Involved:
QUOTE_ADAPTER (see Basic Stock-List Demo).
LiteralBasedProvider (see Basic Stock-List Demo).
>> Flex 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 (not available in Lightstreamer Moderato)
Flex: DOCS-SDKs/sdk_client_flash_flex(native_as)/examples/FlexStockListDemo
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).
Other Clients
Other sample client applications are available for different technologies. You can check out the following folders:
.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 ME Client - Stock & Interaction Midlet
Java: DOCS-SDKs/sdk_client_java_me/examples/StockList_Interaction_Midlet
[NOTE: These clients are only supported by Lightstreamer Presto and Vivace, and not by Lightstreamer Allegro]
Footnotes