Skip to content

autopaho OnPublishReceived needs work #326

@MattBrittan

Description

@MattBrittan

Is your feature request related to a problem? Please describe.

autopaho provides AddOnPublishReceived but this only adds the callback to the current connection. This seems like unexpected behaviour, autopaho should remove the need for the user to worry about the connection status, so calling AddOnPublishReceived should create a callback that survices reconnections.

In addition it should be possible to configure PublishReceived callbacks before calling NewConnection.

Describe the solution you'd like

Callbacks set by AddOnPublishReceived should survive reconnections (or the comments should note that this will not happen!).

Describe alternatives you've considered

The user can provide their own way of accessing *ConnectionManager and just use autopaho.ClientConfig.OnPublishReceived. However if we are encouraging this we should probably remove autopaho.AddOnPublishReceived (because I feel it's likely to confuse users).

Additional context

The examples need some work (for exampls autopaho/examples/router/readme.md contains code that would not compile (invents autopaho.ClientConfig.OnPublishReceived).

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