Project Members:

Download project

If you haven't already, download and install the IIoT Client SL which contains the MQTT Client SL library which this project uses to connect.
Get the MQTT PLC Chat project from the repository currently at Code > trunk > MQTTChat.project

Open the project in CODESYS
As always, right click the device in the device tree and "Update Device..." to a device type that matches your PLC.
Menu > Project > Project Environment > Update All
Download to your PLC. The MQTT Client SL library will run for 30mintues before the license expires. you then have to restart your PLC for a further 30 minutes of testing, or just buy a dongle with a license of the IIoT Libraries SL.
Hit Run

Open a visu.
On the Config tab, you can use the default PUBLIC testing broker and testing chat topic. (This will chat with people who also use the defaults :)).
Please change your client ID to something unique (forge username?).
Press Go Online Button in the visu.
Hint: The Diagnosis bar at the bottom will show all of the Flags that are on for the Cli(ent) / Pub / Sub. You want the string "Cli.EN.BUSY.CONN Pub Sub.EN.BUSY.ACTIVE"

Once connected, move to the Chat Tab. type a message, hit enter, then press "Send"
You should see your message added to the list, and also any messages from anyone else sending to the same broker and topic.