1

For my bachelor's thesis, I chose to research the possibility to send real-time workout data such as heart rate, distance, calories, gps,... from a standalone Apple Watch app to a react web application (fitness dashboard). The project should make it easy for family and friends to track your run from home. When researching how to do this I came up with 2 possibilities. The first one is sending the data with socket io to my Python backend server and using WebSockets to send it to the web application. The second option was using the WebRTC technology to create a peer-to-peer connection between the Watch and frontend.

I chose to do the first one because of the complexity of using WebRTC for the first time and lost some time trying to implement it.

I can't help to feel that there should be a better way to do this. As I'm reflecting on the project in my thesis I would like to know if anyone knows a better solution for this use case.

  • The "best" solution totally depends on the specifics of the use case. From the broad explanation you provided I would recommend to go via the server and regard watch->server and server->browser as separate problems – de. May 18 '21 at 10:23
  • But please make your question more specific, you will get better answers and better rating. – de. May 18 '21 at 10:24
  • I updated my question, hope this is specific enough – Berend Vandenbussche May 18 '21 at 15:01
  • Last I checked Apple Watch does not provide live readings [while in the background](https://stackoverflow.com/questions/35039742/ios-get-heart-rate-from-apple-watch-in-near-real-time) the [data is encrypted](https://developer.apple.com/documentation/healthkit/protecting_user_privacy) and can only be seen when in the foreground. Have you tested this at all? What happens if the user opens your app and then turns on music? I would expect updates to stop as soon as the screen goes dark or other apps become active. Have you looked at the guidelines? Apple is picky about sharing HealthKit data. – lorem ipsum May 24 '21 at 01:07
  • 1
    This app was already made and works, even in the background. When starting a workout session on the Watch it keeps on reading new data, this gets send to my backend server with socketio, this last part I’m skeptical about. There should be a better way to send the data to my backend. (Socketio library for swift is outdated) – Berend Vandenbussche May 25 '21 at 05:35
  • This answer is a bit too broad for SO. You would have to go to buildfaast.com or something similar for this. – cjmc May 25 '21 at 13:43
  • @BerendVandenbussche Do you by chance have the code that you used in a git repo somewhere? This looks like nifty to be reused (I want to get my heart-rate into [Home Assistant] :-D) – Volker Stolz Aug 29 '22 at 10:25
  • 1
    @VolkerStolz The code I wrote for this project can be found here: https://github.com/BerendVandenbussche/FitnessDashboard just note it can only send the data while the app is active on the watch. It stops sending data when going to the watch home screen – Berend Vandenbussche Aug 29 '22 at 13:39

1 Answers1

1

You should give StarScream a try, it still gets updates quite regularly and would work perfectly with the solution you have right now. When using WebSockets and therefore a backend it's also quite easy to expand upon this project and add a database if you aren't saving data to one already.

Jaci257
  • 11
  • 1