08-27-2019 07:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-27-2019 07:25
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello!
I am trying to create a client-local server connection between my Fitbit Versa and my local machine, using hard-defined websocket IP addresses. Ultimately, I am trying to stream my real-time heart rate as a console message to my local machine, where my server can handle that data accordingly.
Here is a paste of my code in question: https://pastebin.com/yp64REdT
I am getting this error when I Run my code onto my Versa:
I am brand new to JS, much less Fitbit development, so if this is simple, feel free to rip me open for not knowing lol... but do you guys have any clue for how to get this code running smoothly?
Thank you!
Answered! Go to the Best Answer.

Accepted Solutions
08-27-2019 13:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


08-27-2019 13:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I don't think WebSockets are available on the watch itself. You have to use file transfer or messaging to get data from watch to companion; then you can use WebSockets on the companion.
Gondwana Software

08-27-2019 07:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-27-2019 07:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hey guys... use this PasteBin link instead, this is the actual code that flags the error. I was toying around with the import function to see if that had anything to do with it.

08-27-2019 13:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


08-27-2019 13:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I don't think WebSockets are available on the watch itself. You have to use file transfer or messaging to get data from watch to companion; then you can use WebSockets on the companion.
Gondwana Software

08-28-2019 08:30 - edited 08-28-2019 08:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-28-2019 08:30 - edited 08-28-2019 08:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I found it impossible to get Socket.io running on the companion app, as the companion only offers the native WS API. This means you'll have to build your own WS transport and essentially reengineer Socket.io.
If anyone else has managed to connect to a server running Socket.io, please let me know. We're currently polling periodically with HTTP but we consider this a very inelegant solution.
08-28-2019 08:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

08-28-2019 08:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Thank you for your responses, my next question is, when implementing WS using the Fitbit Companion Websocket API, can we use ws connections, or are we limited to only using wss?
If I could use ws, then I could use a simple Python local webserver to connect to the companion program on the same WiFi network.
Has anyone had any luck with this?
Thanks!
