This project is a mobile app plugin written in HTML/JS/CSS with Capacitor that shows you how to connect mobile devices with Fluvio. Connecting your mobile devices directly to a Fluvio cluster without an intermediary backend server reduces latency and the load on other backend services.
Fluvio is an end-to-end distributed data streaming platform that makes it easy to build and run real-time applications. With Fluvio, you can ingest, transform, and dispatch large volumes of events from your mobile devices to backend servers. It connects your devices from edge to core, removing the complexity of building and scaling your middle tier.
Anyone who is building native mobile applications with a low tolerance for latency. For example:
- track cars, trucks, or buses on a map
- monitor stocks and send alerts
- compute gaming stats
- collect health monitoring data
- monitoring traffic conditions
- etc.
-
Clone this project
git clone [email protected]:infinyon/fluvio-client-capacitor.git
-
Install Capacitor
Your computer must have Capacitor installed with an
IOS runtime
. Checkout the Capacitor iOS Documentation for additional instructions.
-
Install Fluvio client:
Download Fluvio client to your local machine.
-
Provision a Fluvio cluster:
Infinyon Cloud - create free account and provision a cluster.
The Sample App in the example directory to demonstrate Fluvio capatibities.
-
In the terminal, open the example directory
cd example
-
Use Fluvio CLI to login to Fluvio Cloud
fluvio cloud login
-
Download your fluvio profile in the
www
directory. This file contains your security profile that allows mobiles devices to connect to InfinyOn cloud.fluvio profile export > www/fluvio-profile.json
-
Create topic in fluvio
fluvio topic create cap-example
-
Build the Sample App
npm install && npm run build
-
Sync to native projects
npx cap sync
-
(iOS) Open XCode to deploy to simulator
npx cap open ios
Congratulations! Your enviornment is up and running. Use the GUI to send some records and read from the consumer in the CLI.
-
Use
npm
to install the Fluvio capacitor client in your own app:npm install --save https://github.com/infinyon/fluvio-client-capacitor/releases/latest/download/fluvio-client-capacitor.tgz
-
Sample code to produce records
import { FluvioClient } from '@fluvio/client-capacitor'; import fluvioProfile from './fluvio-profile.json'; const FLUVIO_TOPIC = 'cap-example'; async function example() { let fluvioClient = await FluvioClient.connect(fluvioProfile); await fluvioClient.produce(FLUVIO_TOPIC, "example value"); }
-
static
connect(profile
: Profile):Promise
<FluvioClient
> -
produce(topic:
String
, value:String
):Promise
<void
>
- endpoint:
string
- tls:
FluvioProfileTls
- policy:
string
- domain:
string
- key:
string
- cert:
string
- ca_cert:
string
This project is currently under development and we are seeking help from the community on the following features:
Join our community on Discord and let's build the future of data streaming together.