meshtastic / js

JS/TS library for interfacing with Meshtastic devices
https://meshtastic.org
GNU General Public License v3.0
74 stars 36 forks source link

Make connection failure behaviour more robust #11

Closed thepoweroftwo closed 1 year ago

thepoweroftwo commented 3 years ago

Right now, the TTGO-TBeams go into bluetooth sleep after a while. If the library then tries to read/write from device, it is no longer available, so it fires the "disconnected" event and tries to reconnect three times (with an exponentially increasing wait time between tries). This could lead to confusion, because the behaviour when using http is different, as there is no real connection state.

Proposed behaviour: Make behaviour consistent so that it is clear when a device is finally disconnected and connect needs to be called again.

crossan007 commented 3 years ago

Related topic: I recently added onHTTPTransactionEvent: https://github.com/meshtastic/meshtastic.js/commit/3004c06f35c2a8bd55af6879fd0517d659dc1325