09-02-2017 07:40
09-02-2017 07:40
The messaging docs seem to suggest guarding `send`s on checking the `readyState` of the `peerSocket`.
This leads me to two lines of questioning:
1. When would the messaging socket be closed? Maybe more generally, what's the execution lifecycle of the device app and the companion app and how does that relate to the socket lifecycle?
2. What is the error behavior when a `send` is attempted, but the socket isn't `OPEN`? It seems like the BART example doesn't guard its `send`s and might be usually okay?
Thanks!
Answered! Go to the Best Answer.
Best Answer09-03-2017 10:16
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
09-03-2017 10:16
1. The messaging socket would be closed if the Fitbit mobile application was not running, or bluetooth was disconnected.
2. You'd get an error in the console log, and the `onerror` event should be emitted.
09-03-2017 10:16
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
09-03-2017 10:16
1. The messaging socket would be closed if the Fitbit mobile application was not running, or bluetooth was disconnected.
2. You'd get an error in the console log, and the `onerror` event should be emitted.
08-02-2021 16:16
08-02-2021 16:16
I tried using the "close" event listener on messaging api and even though the companion has unloaded, which means that the socket's would be closed, the "close" event listener does not trigger whatsoever.
Using SDK: 4.3.0
Best Answer