This project includes a demo client showing integration between the Lightstreamer JavaScript Client Library (Node.js version) and React Native
JavaScript Objective-C Java
Permalink
Failed to load latest commit information.
android First commit Apr 11, 2016
components First commit Apr 11, 2016
images First commit Apr 11, 2016
ios First commit Apr 11, 2016
.babelrc First commit Apr 11, 2016
.flowconfig First commit Apr 11, 2016
.gitignore First commit Apr 11, 2016
.watchmanconfig First commit Apr 11, 2016
LICENSE First commit Apr 11, 2016
README.md Update references to SDK after recent release. Jul 25, 2016
index.android.js First commit Apr 11, 2016
index.ios.js First commit Apr 11, 2016
package.json First commit Apr 11, 2016
screen_stocklist.png First commit Apr 11, 2016
screen_stocklist_large.png First commit Apr 11, 2016

README.md

Lightstreamer - Stock-List Demo - React Native Client

This project contains a demo application showing the integration between the Lightstreamer Node.js Client Library and React Native.

Live Demo

screenshot

View live demo

Details

This app, compatible with iPhone, is a React Native version of Stock-List iOS Client.

This app uses the Lightstreamer Node.js (formerly JavaScript) Client Library to handle the communications with Lightstreamer Server. A simple user interface is implemented to display real-time market data for ten stocks generated by a feed simulator.

If you want to go deeper into React Native, check out the React Native site.

Install

Binaries for the application are not provided, but it may be downloaded from the App Store at this address. The downloaded app will connect to Lightstreamer's online demo server.

Build

A full Xcode project specification, ready for compilation of the app sources, is provided. Please recall that you need a valid iOS Developer Program membership to run or debug your app on a test device.

Before you can build this demo, you need to install various required tools.

Requirements

This guide assumes OS X which is needed for iOS development.

  • Install Xcode 7.0 or higher. It can be installed from the App Store.

  • If you don't have Node.js installed on your system, please go to Node.js download page and get the latest stable Machintosh version (it includes the also required npm).

All the following commands need to be typed on a command line window.

  • Install watchman, for instance with Homebrew by doing:
$ brew install watchman
  • Install the React Native command line tools: (if you see the error EACCES: permission denied, please run the command preceded by sudo)
$ npm install -g react-native-cli
  • Go into the Lightstreamer-example-StockList-client-reactnative folder and get dependencies with command:
$ npm install

Compile and Run

  • Create an app ID on the Apple Developer Center.
  • Create and install an appropriate provisioning profile for the app ID above and your test device, on the Apple Developer Center.
  • Set the app ID above as the Bundle Identifier of the Xcode project of the app.
  • Set the IP address of your local Lightstreamer Server in the constant SERVER_ADDRESS, defined in components/Constants.js.
  • Follow the installation instructions for the Data and Metadata adapters required by the demo, detailed in the Lightstreamer - Stock-List Demo - Java Adapter project.

Done this, the app should run correctly on your test device and connect to your server.

If you simply want to build and run the demo app on the iPhone Simulator, you need to change the JavaScript code location, because no pre-bundled file is generated when running the project on it in the "Debug" build configuration. You must open AppDelegate.m file, comment out the second option (which uses pre-bundled file) and instead enable the first.

Babel Note

As of version 0.5.0, React Native ships with the Babel JavaScript compiler. It make writing code more enjoyable by allowing you to use new JavaScript ES6 syntax. Anyway, we need to ignore Lightstreamer Client npm module from Babel transformation in order to avoid problem with ES6 module code specification, which is interpreted as strict mode code (see .babelrc file in project folder).

See Also

Lightstreamer Adapters Needed by This Demo Client

Related Projects

Lightstreamer Compatibility Notes

  • Compatible with Lightstreamer Node.js (formerly JavaScript) Client Library 6.2.7 or newer.