eclipse / paho.mqtt.m2mqtt

Eclipse Public License 1.0
519 stars 303 forks source link

feature(M2Mqtt): Adds auto reconnect, #91

Open bradder555 opened 6 years ago

bradder555 commented 6 years ago

Auto reconnected has been added,

The workflow has been changed a little bit, but there are no breaking interface changes, thus the new version should work with existing code without any requirement for code changes.

Some new callbacks have been added for various events (i.e. reconnected)

The new interface is you have the client, you can add and remove topics from the client these are stored in a list on the client

When the client connects or reconnects, subscribeAll is called, this subscribes to all of the topics on the client.

subscribe and unsubscribe work exactly as they did before but now they keep the topics list up to date

the classes have been changed to a program, maybe this was a bad idea, but i found the program assisted the development process, the nice thing is, you can still use the program as a library so no harm there.

The default-sane configuration is chosen (i.e. autoreconnect by default) etc

Made some minor interface changes to make the app a little nicer in places

PPaques commented 5 years ago

We use this PR in production. Hope it will be merged upstream one day.

bradder555 commented 5 years ago

Cool, I'm glad you find it useful, I've noticed there's a fair few downloads on NuGet.

We've since moved onto m2mqtt :).

I'd like to write a minimal implementation from scratch.

liaoliaoda commented 4 years ago

hi, is there any sample abot auto reconnect function?

qubbei commented 2 years ago

How to use official packages for automatic reconnection