This project contains a demo application showing the integration between the Lightstreamer Client Library and React Native.
This app, compatible with iPhone and Android, is a React Native version of Stock-List iOS Client.
This app uses the Lightstreamer Web 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.
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.
This guide assumes OS X, which is needed for iOS development.
-
Install Xcode 10.0 or higher. It can be installed from the App Store.
-
Install Node.js version 14.0 or newer (it includes npm as well).
-
Install Ruby version 2.7.6 or newer. Since macOS 13.2 is shipped with Ruby 2.6.10, which is not what is required by the latest version of React Native, we suggest to install the proper version of Ruby in your system by means of a Ruby version manager. Some common Ruby version managers are:
-
Install the latest version of Cocoapods.
All the following commands need to be typed on a command line window.
- Install watchman, for instance with Homebrew by doing:
$ brew install watchman
- Go into the folder Lightstreamer-example-StockList-client-reactnative and get the dependencies with the command:
$ npm install
- Go into the folder Lightstreamer-example-StockList-client-reactnative/ios and run the following command to install Ruby's Bundler (a Ruby gem that helps managing the Ruby dependencies of the project) and the iOS dependencies:
$ bundle install
$ bundle exec pod install
-
Open the file ios/ReactDemo.xcworkspace with Xcode
-
Set the IP address of your local Lightstreamer Server in the constant
SERVER_ADDRESS
, defined incomponents/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.
Before you can build this demo, you need to install various required tools.
-
Install Node.js version 14.0 or newer (it includes npm as well).
-
Install Java Development Kit 11 or newer.
-
Install Android Studio. While on Android Studio installation wizard, make sure the following items are checked:
- Android SDK
- Android SDK Platform
- Android Virtual Device
-
Set the IP address of your local Lightstreamer Server in the constant
SERVER_ADDRESS
, defined incomponents/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.
-
Start an Android emulator
-
Run the following commands from the project folder:
-
npx react-native start
-
npx react-native run-android
-
Done this, the app should run correctly on your test device and connect to your server.
- Lightstreamer - Stock- List Demo - Java Adapter
- Lightstreamer - Reusable Metadata Adapters- Java Adapter
- Lightstreamer - Stock-List Demos - HTML Clients
- Lightstreamer - Stock-List Demo - iOS Client
- Lightstreamer - Stock-List Demo with APNs Push Notifications - iOS Client
- Lightstreamer - Stock-List Demo - Android Client
- Lightstreamer - Basic Stock-List Demo - OS X Client
- Lightstreamer - Basic Stock-List Demo - Electron Client
- Lightstreamer - Basic Stock-List Demo - HTML (React) Client
- Compatible with Lightstreamer Client Web SDK 9.0.0 or newer.
- For Lightstreamer Server version 7.3.2 or greater.
- For a version of the demo compatible with Lightstreamer Client Web 8.0, check out this tag.