Skip to content

Document MQTT version support #26

@jiferrero

Description

@jiferrero

Hi,

Which MQTT version does the library currently support? We are struggling our heads to know why our arduino nano 33 iot always get a connection refused when connecting to EMQX 4.x broker but not when connecting to mosquito.

const char broker[] = "test.mosquitto.org";
int port = 1883;
WiFiClient wifiClient;
MqttClient mqttClient(wifiClient);

void setup() {
  Serial.begin(1000000);
  while (!Serial);

  while (WiFi.begin(ssid, pass) != WL_CONNECTED) {
    // failed, retry
    Serial.print(".");
    delay(5000);
  }

  Serial.println("Device connected to the network");
 
 if (!mqttClient.connect(broker, port)) {
    Serial.print("MQTT connection failed! Error code = ");
    Serial.println(mqttClient.connectError());
    while (1);
  }

  Serial.println("You're connected to the MQTT broker");
}

that ends up with a succesfully connection to "test.mosquitto.org".

But if we use for example:
IPAddress broker(192, 168, 1, 33);

then we always ends up with an unsuccessfully connection. We have no idea why... port 1883 is open and accessible from local network but EMQX 4.x broker supports MQTT 3.1.1 and 5.0
Could be that the problem? Any other idea?

Thank you so much in advance

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions