Skip to content

This project contains a simple Python script that shows a minimal client-side implementation of the Lightstreamer Server Text mode Protocol

License

Notifications You must be signed in to change notification settings

bledubd/Lightstreamer-example-StockList-client-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lightstreamer - Basic Stock-List Demo - Python Client

This project contains a simple Python script that shows a minimal client-side implementation of the Lightstreamer Server Text mode Protocol.

screenshot

Details

The example provides a very simple version of the Stock-List Demos, where a single subscription to 12 items is submitted. The updates are then formatted and displayed on the console.

The script shows all the basic steps required to establish an interaction to Lightstreamer Server. More specifically, the code comprises these actions:

  • Connection to Lightstreamer server and session creation
  • Subscription to items with specified fields
  • Notification about real time updates
  • Unsubscription from items
  • Final disconnection

It is important to highlight that the example is not meant to be a complete and robust Lightstreamer Client Python library, but it could be used as a starting point to build more complex interactions with the Lightstreamer server to manage all the possible scenarios included in the protocol.

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.
  • Go to http://python.org/download/ and download the appropriate Python (tested since version 2.6.3) for your OS and follow the instructions to install it on your system. Note that the demo currently can not be launched from IDLE.

You can now run the Python script simply executing the following commands on different OS:

  • Windows machines:
start python /path/to/example/stock_list_demo.py
  • Linux machines:
python /path/to/example/stock_list_demo.py

or, alternatively, you can make the script executable:

chmod +x /path/to/example/stock_list_demo.py

and then type:

/path/to/example/stock_list_demo.py

The example is configured to connect to http://push.lightstreamer.com:80, but you can easily change these settings modifying the following line:

lightstreamer_client = LSClient("http://push.lightstreamer.com:80", "DEMO")

to connect to the correct combination of host and port of your Lightstreamer server.

See Also

Lightstreamer Adapters Needed by this Demo Client

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer server since version 6.0.
  • For Lightstreamer Allegro (+ Generic Client API support), Presto, Vivace.
  • For a version of this example compatible with Lightstreamer server version 5.1.2, please refer to this tag.

About

This project contains a simple Python script that shows a minimal client-side implementation of the Lightstreamer Server Text mode Protocol

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%