11-13-2017 05:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-13-2017 05:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hi,
I'm working on a small app that just fetches some JSON on the companion side, and then forwards it to the watch for displaying. It's almost identical to the Weather Example posted of the Messaging Guide.
However, I can only get it to work about 20% of the time. I have the developer bridge enabled on both my phone and the watch. A lot of the times the "onopen" callback is never called, and even if it is there's a high chance that no data will make it through.
I did notice the companion app is often marked as "Inactive". If I just keep on redeploying it again and again it will work eventually, usually in about 20% of the cases. Therefore I don't think there's an issue in my code (it's as trivial as the weather example, and looks identical), and it does work, if the API manages to make the connection and send the data through.
On the other hand, the built-in weather app provided by Fitbit seems to work fine at all times, although I'm not sure if it is built on the same SDK that we use (maybe the fitbit OS devs can develop "native" apps?).
Are there others experiencing similar issues? Any ideas on how to address this?
11-14-2017 12:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-14-2017 12:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Would you be willing to post an example project on Github so we can take a look? Can you also let me know iOS/Android versions etc. Thanks
For your reference, the weather app uses the File Transfer API to periodically send the data.
11-16-2017 00:22 - edited 11-16-2017 00:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-16-2017 00:22 - edited 11-16-2017 00:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I am having the same issues. I have to remove the app completely from the watch and then redeploy in order to get it to work. Even then, there are issues with the peer connection working consistently and the data being passed from the companion to the app.
I am working with Android
11-17-2017 12:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-17-2017 12:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Always been the case with me as well. I just keep installing it until it works. Seems the Settings page will be inactive until the watch app/clockface has fully finished executing.
12-12-2017 03:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-12-2017 03:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I have timed it and there is 1929 millisecond between when the companion starts and when the peer connection opens. This means that I cannot pass error messages to the device.
Is there any word on when this will be looked at?
12-20-2017 01:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-20-2017 01:33
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I am having similar issues as well.
It seems like the sync between the Fitbit app (iOS) and the Ionic triggers the companion app and subsequent data transfer but is there any alternative?
I am using the weather example as well and it appears the 'refresh interval' is somewhat useless? I would post to Git but it seriously is just like the weather example on the Fitbit dev site.
At a high level, how is the watch-to-companion interaction supposed to occur?

12-25-2017 09:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-25-2017 09:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I have similar problem, the messaging.peerSocket.onopen will never fire up when the program is just uploaded to ionic watch. This can be temporarily solved by exit the program and run it again manually.
12-29-2017 19:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-29-2017 19:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I have the Weather function in my clockface start 5 sec after the clockface starts and it retries every 5 seconds until it gets the weather.

03-02-2018 05:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-02-2018 05:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Does that work consistently for you?

03-28-2018 19:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-28-2018 19:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Do you have any news about this bug? I just use the messaging module to communicate the companion with the app and the connection is established very rarely ...

03-29-2018 12:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


03-29-2018 12:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
@pachesnel wrote:
Do you have any news about this bug? I just use the messaging module to communicate the companion with the app and the connection is established very rarely ...
Can you provide some information about your setup? Are you Android/iOS/Windows. Have you applied the latest mobile app updates and latest device firmware?

04-07-2018 12:40 - edited 04-07-2018 13:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-07-2018 12:40 - edited 04-07-2018 13:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I worked all morning on my little application and the connection between the companion and the app worked without problems.Then suddenly nothing worked and I have this message error : Connection error: 2 - unknown(Optional(8))
I Try :
- Delete app + reinstall
- Stop reload Fitbit studio
- Empty the cache on the web page
- Restart the Iphone
- Restart the watch
however, it works very well with the simulator
- My iPhone 6 as the last version 11.3 of the OS
- My Ionic as the last version : 32.4.1

04-07-2018 15:19 - edited 04-07-2018 15:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-07-2018 15:19 - edited 04-07-2018 15:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Ok, I try to find why the peerSocket on companion stop working and apparently the problem become from the size of the message I try to send between companion and app. at first I used a JSON format of this type without any problem with the simulator and the ionic watch.
{"statePrinter":"Printing","printName":"Kossel Mini","filePrintName":"KM_jonction_1","percent":0,"temperature":20.33,"temperatureTarget":0,"temperatureBed":54.81,"temperatureBedTarget":60,"printTimeLeft":"30"}
After a few hours of coding, I could not use peerSocket.send () on the companion side with the ionic but everything worked on the simulator.
I tried later to send a shorter message and it worked! So I changed my json for a simple array :
["Printing",Kossel Mini,"KM_jonction_2",3,220.02,220,60.24,60]
I'm happy to have found the problem, however I had typed this:
// Listen for the onerror event peerSocket.onerror = function(err) { // Handle any errors console.log("Connection error: " + err.code + " - " + err.message); }
and my error message returned is not very explicit ...
Connection error: 2 - unknown(Optional(8))

04-07-2018 20:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-07-2018 20:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I spoke a little fast. The message is back, What is strange is that my buffer returns to me a value of 50, which seems to me below the limit. I now go through a file where I store the information, it works for now but I would still like to understand my concerns with peerSocket.send () buffer limit.

