Closed larsenglund closed 8 years ago
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:
mqttClient.set_server(mqttIp, mqttPort);
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?
Not connected..
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 >_<
I can't get it to connect. I can connect just fine from a PC. I create my objects like this:
then set the server ip and port like this
mqttClient.set_server(mqttIp, mqttPort);
then in loop i do this:But it just prints
Not connected..
once every 15s which I guess is the timeout... Am I overlooking somthing?