onConnect is now called either when connect is called or when the state transitions (from offline to online)
- this behavior contradicts the documentation https://github.com/electricimp/ConnectionManager#parameters-2
Called when ConnectionManager’s connection state changes from offline to online. The callback function has no parameters. (However, in the rest of the places it's properly described).
I believe onConnect should be called only when the transition happens or there should be a way to distinguish connection from just the connect call (when already connected).
There are multiple options for how to address this:
- add a new
onStateChange (name TBD) callback - backward compatible
- add a flag to the existing
onConnect callback - breaking change