-
Notifications
You must be signed in to change notification settings - Fork 110
Description
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).