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

Can't connect.. #53

Closed
larsenglund opened this issue Mar 10, 2016 · 1 comment
Closed

Can't connect.. #53

larsenglund opened this issue Mar 10, 2016 · 1 comment

Comments

@larsenglund
Copy link

I can't get it to connect. I can connect just fine from a PC. I create my objects like this:

WiFiClient wclient;
PubSubClient mqttClient(wclient);

then set the server ip and port like this mqttClient.set_server(mqttIp, mqttPort); then in loop i do this:

  if (!mqttClient.connected()) {
    Serial.println("Not connected..");
    if (mqttClient.connect("test")) {
      mqttClient.set_callback(mqttCallback);
      mqttClient.subscribe("inTopic");
      mqttClient.publish("outTopic", "Hello!");
    }
  }

  if (mqttClient.connected()) {
    mqttClient.loop();
  }

But it just prints Not connected.. once every 15s which I guess is the timeout... Am I overlooking somthing?

@larsenglund
Copy link
Author

Wrong mosquitto version was the problem, I just assumed I would get the latest version by simply apt-getting but that gave v0.15, assumptions are bad for you >_<

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