Mqtt Client connection delay

I’m using and libraries for MQTT Client and Broker communication…
my Problem is "taking much more time for connection (function: mqttConnect(); ) and sometimes connection failed also.
I want to publish data to MQTT-Broker for every 10mins interval.

plz give me suggetions to solve this.


i dont know this is right place to ask my doubts,Any one plz give me suggetions

The connection delay can be due to the network. May be the code library is waiting for some event. You can try the same by entering AT commands for TCP connection on a terminal software and see if the delay is same. If not, then your code is waiting for something and causing the delay.
The connection are little slow on 2G modules but you should be able to connect in 2 or 3 seconds max.

I’m using AT COMMANDS lyk this for Just TCP CONNECTION…can you tell me the step by step commands for MQTT Connection and MQTT Publish…I’m using Docklite for Debugging.

I dont know AT commands for this module. But the flow should remain the same as shown in my video.
What is ABCDEF, it doesnt look like a MQTT packet.?

thanq for reply sir,
from above pic ABCDEF is just random data lyk ABCEDFGH…YZ…
the above AT Commands are Just for normal data sending over TCP link using M680 modules…