Hello,
I successfully used the official ArduinoMqttClient Library on Opta via the PLC IDE sketch session. Make shure you use the Arduino_ConnectionHandler libraries to mantain the connection alive.
See under Examples-> Arduino Cloud Provider Examples-> AWS IoT-> AWS_IoT_Opta and select Ethernet or WiFi sketch to choose your variant.
Hope it helps,
Marco