Wednesday, March 22, 2023

Getting Ionic 6 to run on iOS 12+


The issue was to get ionic 6 running on an old iOS 12.5.7. 

At the time of writing this, ionic 6.20.9 and capacitor 4 where the latest versions. By rolling back to capacitor 3, it was possible to deploy the app to the old version 12 phone.

The nodejs version used was v18.14.0

Below is the app shown listing the results of scanned devices using cordova-plugin-ble-central plugin.


As described here,  install ionic with:

npm install -g @ionic/cli

ionic --version

6.20.9

Then create a ionic project (Angular was chosen for this project)

ionic start

After the project has been created, remove version 4 of capacitor and install version 3 (https://capacitorjs.com/docs/v3/getting-started) as follows:

npm uninstall @capacitor/ios @capacitor/cli @capacitor/core --save

npm install  @capacitor/ios@latest-3 @capacitor/cli@latest-3 @capacitor/core@latest-3 --save

You should see 3.9.0 when running:

npx cap --version 

3.9.0

Then add the ios platform as described here: https://capacitorjs.com/docs/v3/ios

npx cap add ios

In the ios/App/Podfile file, you should see:

platform :ios, '12.0'

Now, build and deploy the project.

npm run build

npx cap sync

npx cap open ios

To add the plugin run:

npm i cordova-plugin-bluetoothle --save







Tuesday, March 21, 2023

A concept2 Remote Racing Prototype Architecture

This article is about a prototype which was created to connect together concept2 PM5 erg computers via the internet. The system makes it possible to remotely race each other in groups or races without a central organiser. 

A mobile app created with Ionic (see picture below) is used to connect to the local PM5 via Bluetooth. The app, called Ergregatta, sends data collected from the local PM5 computer to a remote server as well as displays realtime race information about other participants received from the remote server. 


The Ergregatta messing server is a Spring Boot app with a single web socket endpoint. The web socket handling is implemented Java-WebSocket from TooTallNate; a very nice, simple and clean implementation.

The server groups racers into races by using the raceId, a md5 hash of the username hosting the race, which submitted as a query parameter to the web socket endpoint before the connection upgrade.  

By hosting the server in a Kubernetes cluster, as shown below, it possible to get horizontal scaling of the servers, by using Istio to route web socket requests with the same raceId to the same server instance or pod (see below).



The installation show with kubectl. One can see the ergregatta message pods running.


This is how the setup looks with Kiali, which is provided by the istio installation.



However, even better than Kiali, is a Grafana dashboard which shows the actual routing of the requests by pod.