MQTT cannot conect to broker (tcp)

Hi, I encounter problems when connecting to our broker. I can connect to the mosquitobroker. I can connect with my pc to the broker with different mqtt clients. On the plc i can ping outside, so that is not a problem. this is my config: {

“brokers”:[{
“host”: “tcp://aviary.canary.expert:1883”,
“client_name”: “MQTT_Test_App”,
“timeout”: 60,
“status_port”: “Arp.Plc.Eclr/MQTT.MQTT_Broker_Status”,
“reconnect_port”: “Arp.Plc.Eclr/MQTT.MqttReconnect”,
“connect_options”:{
“keep_alive_interval”: 30,
“connect_timeout”: 30,
“username”: “LANXESS”,
“password”: “Lanxelot”,
“max_inflight”: 0,
“will_options”:
{
“topic”: “last_will_topic”,
“payload”: “auf wiedersehen”,
“qos”: 0,
“retained”: false
},
“is_clean_session”: true,
“mqtt_version”: 0,
“automatic_reconnect”: false,
“min_retry_interval”: 0,
“max_retry_interval”: 0
},
“publish_data”:[{
“port” : “Arp.Plc.Eclr/MQTT.PubMessage”,
“qos” : 0,
“period”: 60,
“retained”: false,
“topics” :[
“CANARY/DOMICA/SN/DDRVerzend”
]
}],
“subscribe_data”:[{
“topic” : “CANARY/DOMICA/SN/DDROntvang”,
“ports” :[
“Arp.Plc.Eclr/MQTT.SubMessage”
]
}]
}]
} The error is : 24.10.19 15:07:26.755 PxceTcs.Mqtt.GdsConnectorComponent INFO - Loaded configuration from file: /opt/plcnext/projects/MqttClient/mqtt_gds.settings.json 24.10.19 15:07:26.755 PxceTcs.Mqtt.GdsConnectorComponent INFO - Loaded configuration from file: /opt/plcnext/projects/MqttClient/mqtt_gds.settings.json 24.10.19 15:07:26.757 PxceTcs.Mqtt.GdsConnectorComponent INFO - Loaded configuration schema. 24.10.19 15:07:26.764 PxceTcs.Mqtt.GdsConnectorComponent INFO - Configuration is valid. 24.10.19 15:07:26.766 PxceTcs.Mqtt.GdsConnectorComponent INFO - No reconnect port has been specified. 24.10.19 15:07:26.772 PxceTcs.Mqtt.GdsConnectorComponent INFO - Created MQTT Client with ID: 35995 24.10.19 15:07:26.773 PxceTcs.Mqtt.GdsConnectorComponent INFO - Global timeout value has been set to 60 milliseconds 24.10.19 15:07:26.773 PxceTcs.Mqtt.GdsConnectorComponent INFO - No MQTT SSL/TLS Options provided. Defaults will be used. 24.10.19 15:07:26.775 PxceTcs.MqttClient.MqttClientManager INFO - Connecting to MQTT server 24.10.19 15:07:26.840 PxceTcs.MqttClient.MqttClientManager ERROR - Exception in operation: Connect(35995, ConnectOptions) 24.10.19 15:07:26.841 PxceTcs.MqttClient.MqttClientManager ERROR - MQTT error [-1] 24.10.19 15:07:26.842 PxceTcs.Mqtt.GdsConnectorComponent ERROR - Error connecting to MQTT Client 35995 Do you have any idea? Kind regards, David de Roo

Hi David, We have had reports of the MQTT app not connecting when the broker requires a username and password (although TLS connections with security certificates work OK). The fact that you can connect to the Mosquitto broker - which does not require a username and password - indicates that this may be the problem you are seeing. Unfortunately I don’t know when we will have the chance to investigate this issue, or to provide a solution. If this is a critical issue for you please let us know. Martin.



Hi Martin, this is a critical issue for us as we cannot set our broker without the security of at least a username and password. We are using the username to divert the data to the specific client. Our broker can work with wss with username and password, but we also fail to connext the mqtt broker. The biggest problem is that our deadline to deliver the project is November 1th. Kind regards, David

Hi David, please excuse the inconvenience. We’ll investigate the issue beginning of next week and will try to offer you a fix in time. Considering the timeline it might be necessary to go ahead at first with a beta, in this case we come back to you directly by mail. Keep you updated! Have a nice weekend!

Hello David, We have found a documentation error in the current version of the MQTT app that causes connections to a broker to fail, if the broker requires a username and password. In your mqtt_gds.settings.json configuration file, please change the following line:

"username": "LANXESS",

to this:

"user_name": "LANXESS",

(that is, change the field name username to user_name). I have tested that this is working using a Mosquitto broker on our network here. Please try this with your own broker. - Martin.