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

Problems on reconnecting when manually disconnected before #33

Open
devTechi opened this issue Jun 12, 2015 · 0 comments
Open

Problems on reconnecting when manually disconnected before #33

devTechi opened this issue Jun 12, 2015 · 0 comments

Comments

@devTechi
Copy link

Hey,

is it possible that the call for mosquitto_loop_forever(mosq, -1, 1); is missing in (void) reconnect?
If the client has a connection and you disconnect from it manually you could try to reconnect using the same client. But this wont work unless you add the call formosquitto_loop_forever(mosq, -1, 1);`.

Please see what I mean.
In MQTTKit.m change from:

- (void) reconnect {
    mosquitto_reconnect(mosq);
}

to:

- (void) reconnect {
    mosquitto_reconnect(mosq);

    dispatch_async(self.queue, ^{
        LogDebug(@"start mosquitto loop on %@", self.queue);
        mosquitto_loop_forever(mosq, -1, 1);
        LogDebug(@"end mosquitto loop on %@", self.queue);
    });
}

With this change the client gets messages again and everything seems to work just fine again. Or am I missing some details?

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

1 participant