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

When would a messaging socket be closed?

ANSWERED

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!

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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.

View best answer in original post

Best Answer
2 REPLIES 2

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.

Best Answer

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
0 Votes