Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

peerSocket does not open

I am trying to get the BART example working, but the peersocket readystate never moves to open, so data is never sent to the Ionic.  The console logging shows that the data is being fetched correctly, it just never passes the readstate==open check.  I do have a solid bluetooth connection between my Ionic and my device.

 

Does anyone know if something is missing from the example or what may be wrong?

Best Answer
0 Votes
10 REPLIES 10

Are you also enabling the Developer Bridge on the Fitbit App in your mobile phone?   If this is not enabled, this could be the reason why the peersocket is not working. 

 

Best Answer
0 Votes

It is enabled, otherwise it would not deploy and I would not have seen the results of the HTTP fetch.

Best Answer
0 Votes

Try to put a console.log message on the receiving end to see if the message is passed. Also, I always have to try few times to run the app I am developing before seeing the message.

 

E.g. in the app/index.js

// Listen for messages from the companion
messaging.peerSocket.onmessage = function() {
console.log("received data");
}

Best Answer
0 Votes

@agsurf5, the code does already have that and it is not firing.  There are console.logs all over the place and it never shows readystate=open so it never gets to sending the message.  I did try having it send anyway, but that threw an error that it wasn't connected as I expected it would.

Best Answer

Looks like the problem may be the Windows 10 Fitbit app.  The peerSocket does not open on the companion on either Windows 10 Pro or Windows 10 Mobile, tried using my Kindle Fire HD8 and first try it showed the readyState===Open and it got to sending the message.

Best Answer

I am having the same issue on Lumia 950. Setting works fine for built-in clock faces, but not for my own app. I am also having issues with the weather app - it is working for a few days and then it stops suddenly - I have to uninstall/reinstall the phone app to get it working again.

Best Answer
0 Votes

Ok I got it working on Windows 10 Mobile: 

The socket opens fine, but it is the "messaging.peerSocket.readyState === messaging.peerSocket.OPEN" part that does not work. Changing this check in the companion code to "messaging.peerSocket.readyState == 0" fixed the issue.

Best Answer

@jimm98y wrote:

Ok I got it working on Windows 10 Mobile: 

The socket opens fine, but it is the "messaging.peerSocket.readyState === messaging.peerSocket.OPEN" part that does not work. Changing this check in the companion code to "messaging.peerSocket.readyState == 0" fixed the issue.


I know the open and closed constants were missing in one of the releases. Is the Fitbit windows mobile app up to date?

Best Answer
0 Votes

According to Windows Store there is no available update. In the about it shows version 2.27.1318(49165).

Best Answer
0 Votes

@jimm98y wrote:

According to Windows Store there is no available update. In the about it shows version 2.27.1318(49165).


It's fixed in the next version, which should be available within the next few days.

Best Answer
0 Votes