Skip to content

onConnect/onDisconnect should be triggered only on the connection state transition #30

@ppetrosh

Description

@ppetrosh
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions