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

Simulator with Websocket and localhost

I am reviving a question asked a while ago that did not receive an answer: https://community.fitbit.com/t5/SDK-Development/Simulator-with-websocket-and-localhost/td-p/4211835

 

I want to test a Fitbit app using Fitbit OS simulator and a companion using either an Android simulator or an actual Android device tethered to the laptop. Right now, the websocket does not connect. As stated in the previous question, the console gives the following error:

InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.

 

For example, if I deploy fitbit-accel-fetcher  to the Fitbit OS simulator and android-fitbit-fetcher to the Android Emulator or an Android Device tethered to the laptop, I am seeing this condition.

 

Is it possible to test a Fitbit app within the Fitbit OS simulator connected to a companion app either within an Android simulator or tethered actual Android device?

Best Answer
0 Votes
6 REPLIES 6

Have you tried with a real Fitbit device, not the simulator?

 

Also, the simulator doesn't simulate the accelerometer.

Best Answer
0 Votes

Yes, I have and it is working.  The watch is sending the data to the companion app and it is sending it to the AWS Lambda function.  Since I can submit files to the AWS Lambda function through the companion app, what is the purpose of the android-fitbit-fetcher app? If I look at the Communications Guide, I don't see an Android app in that picture.  I am trying to figure out all the moving parts.

Best Answer
0 Votes

android-fitbit-fetcher is just a server hosted on the local Android device that can receive data from companion. You don't need it because you're using AWS instead.

(I assume you weren't talking about the Fitbit mobile app on Android.)

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Yes, I was.  The reason I asked is that I was looking at Brian Jackson's fork of your material (converting his C# server code into Node.JS) and I noticed that he also included/referenced your Android app and was curious about the inclusion since he was also sending the data to Azure.  Unless he needed the Android app because it was capable of sending MQTT and the Javascript within the companion app was not?

Best Answer
0 Votes

I'd say that the Fitbit mobile app on Android 'hosts' your companion code (ie, provides the environment within which it runs). It implements the Fitbit companion API that your companion code can call. Therefore, communications sent from your companion code go through the Fitbit mobile app.

 

android-fitbit-fetcher is a completely separate app to the Fitbit mobile app.

 

The only need to use android-fitbit-fetcher (or equivalent) is if you don't have access to some other server and/or you can't get a non-self-signed SSL certificate on your server. I don't think those conditions apply in your case. Perhaps there's also an advantage if you need to reformat the comms traffic before it leaves your Android, but I'd try to avoid that because there's enough middlemen (middlepeople?) involved already.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Thank you for the update and information. I was trying to place the Android app within the architecture and just could not figure out its place in the world.

Best Answer