Anonymous User
  Sunday, 02 February 2020
  2 Replies
  2.2K Visits
I have a problem connecting to mosquitto MQTT server using authentication (without TLS and without websockets). I use the client the following way (I modified the Client demo):

MQTT.Client := WSClient;

txtParameters.Text := '/';
chkTLS.Checked := False;
MQTT.Authentication.Enabled := False;
MQTT.Authentication.Username := 'openhabian';
MQTT.Authentication.Password := 'mypassword';
MQTT.MQTTVersion := mqtt311;
txtHost.Text := '';
txtPort.Text := '1883';
chkTLS.Checked := False;
chkOverWebSocket.Checked := False;

When I connect the Client displays immediately:

#exception: Connection Closed Gracefully.

The mosquitto log displays only:

1580681116: New connection from on port 1883.

What am I doing wrong? Connections to this IP using MQTT-Explorer using the same connection settings work correctly. The "Client" connects correctly to but without authentication but not to my mosquitto server on raspbian.
4 years ago
If you need authentication, enable Authentication property (in your code is set to false).

MQTT.Authentication.Enabled := True;
4 years ago
It works correctly, thank you! I have obviously overlooked this property :)
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf
· Insert · Remove
  Upload Files (Maximum 10MB)