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

Add reconnect logic #11

Closed
wants to merge 1 commit into from
Closed

Add reconnect logic #11

wants to merge 1 commit into from

Conversation

bonan
Copy link
Member

@bonan bonan commented Jan 2, 2020

Added reconnect logic and better error messages on MQTT errors

@bonan bonan requested a review from daenney January 2, 2020 08:49
@@ -142,24 +147,29 @@ func (m *mqtt) init(ctx context.Context, client mqttClient) (err error) {
return
}

func (m *mqtt) onConnect(server string, code byte, err error) {
func (m *mqtt) onConnect(server string, _code byte, err error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little weird. The _ thing isn't something we normally do in Go, and if all we're going to do is transform it into a Code, why not accept a Code to begin with?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature has to match libmqtt.ConnHandler:

type ConnHandler func(server string, code byte, err error)

I could name it something else, like rawCode instead

@bonan
Copy link
Member Author

bonan commented Jan 2, 2020

Fixing issue #12 instead of implementing reconnect

@bonan bonan closed this Jan 2, 2020
@daenney daenney deleted the fix-reconnect branch January 2, 2020 09:44
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

Successfully merging this pull request may close these issues.

2 participants