Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnect to server #1

Open
wolfeidau opened this issue Mar 21, 2015 · 2 comments
Open

Reconnect to server #1

wolfeidau opened this issue Mar 21, 2015 · 2 comments

Comments

@wolfeidau
Copy link

Just wanted to get your thoughts on the best way to reconnect to an MQTT server using your library.

I noted you have a "handler" for disconnect and wanted to know if you had tested using that to initiate a reconnect?

I am just doing some testing this with this library and at the moment that is the only question.

@iambudi
Copy link

iambudi commented Mar 15, 2018

Any update about this @wolfeidau, you might want to share on handling the reconnection.

@iambudi
Copy link

iambudi commented Mar 16, 2018

I could catch the disconnect of message broker in the error handler

client.New(&client.Options{
		// OnDisconnect handler
		ErrorHandler: func(err error) {
			if err.Error() == "EOF" { }

The wierd thing is when i auto reconnect to broker and the target clientID is connected, it works fine, when offline and target ClientID online, the message not submitted. It's like the session is cleaned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants