PLCnext / MqttGdsConnector

This Repository provides a Component for configuration and GDS bindings for the MqttClient Component.
MIT License
5 stars 3 forks source link

When no will options are provided in the config file, mqtt connection fails #9

Open ddewaele opened 4 years ago

ddewaele commented 4 years ago

On my mosquitto broker v1.4, when I plcnext is trying to connect without specifying will options in the config file, the connection fails.

OWarneke commented 4 years ago

Hello ddewaele, thanks for the feedback. We will have to check what exactly causes this issue. As I understand it LastWill should not be demanded by the server...

Some ideas on workarounds: What do you suggest? Making the will config mandatory in the shema or adding a default Will?

ddewaele commented 4 years ago

In my experience, not everyone is using will options so IMHO it should be optional.

I looked at the MQTT specs http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html

and noticed that the connection flags dictate if a will topic / message needs to be provided. I have the impression that your client is sending Connect Flags 0x06 (meaning that it should provide a will topic / message) even when no will options are specified in the config.

So I would make them optional, and set the connect flags accordingly. I think you should send 0x02 if there is no will topic / message.