Need help connecting to MQTT using nRF9160

I can't figure out what I'm missing. I'm not able to send messages using MQTT.

Here's the link to my code: https://github.com/pranav-ether/test/tree/main/mqtt_pub

This are the logs:

[00:02:58.031,768] <inf> LTE: Network registration status: Connected - home network
[00:02:58.031,890] <inf> LTE: Connected to LTE network
[00:02:58.031,921] <inf> LTE: ====== Cell Network Info ======
[00:02:58.033,477] <inf> LTE: Signal strength: 42
[00:02:58.034,210] <inf> LTE: Current LTE band: 8
[00:02:58.034,912] <inf> LTE: Supported LTE bands: (1,2,3,4,5,8,12,13,17,19,20,25,26,28,66)
[00:02:58.035,705] <inf> LTE: Tracking area code: 8CA1
[00:02:58.036,468] <inf> LTE: Current mode: 0
[00:02:58.037,200] <inf> LTE: Current operator name: 65501
[00:02:58.038,146] <inf> LTE: Cell ID of the device: 0E446D21
[00:02:58.039,337] <inf> LTE: IP address of the device: 100.67.202.179
[00:02:58.039,886] <inf> LTE: Modem firmware version: mfw_nrf9160_1.3.5
[00:02:58.040,618] <inf> LTE: LTE-M support mode: 0
[00:02:58.041,259] <inf> LTE: NB-IoT support mode: 1
[00:02:58.041,900] <inf> LTE: GPS support mode: 0
[00:02:58.042,633] <inf> LTE: Mobile network time and date: 24/08/13,06:33:37+08
[00:02:58.042,633] <inf> LTE: ===============================
[00:02:58.043,121] <inf> MQTT: Connection to broker using mqtt_init
[00:04:23.972,839] <err> mqtt_helper: Cloud MQTT keepalive ping failed: -128

Related