Hey Ravi,
So I went through your video for the MQTT using the sim800 module.I have been trying to send MQTT subscribe packets to the Losant broker using the GSM Quectel M66 modem. But I have been unable to do so.
The TCP connection is not giving any trouble, but when I try to create and send the connect packet, I get SEND OK and then no response from the server. To prepare the Hex format I am using DockLight
Similarly tried a connect packet to cloudmqtt and that doesn’t work either.
After the first two characters the length of the remaining message is 140 bytes, so that is 8C in Hex.
The last three characters 1A 0D 0A I’m not counting in the remaining packet length, because that’s basically CR, NL.
Are you taking care of the length for > 127 bytes. In the video there is a algorithm shown in the MQTT spec. It should be used to generate the Remaining length parameter. It can stretch to more than 1 byte.
Ravi,
thanks for that reply, so I did try changing it.
Changed the remaining length from 8C to 80 0C as per the algorithm (for the remaining length of 140 bytes, 10 bytes variable header +130 bytes packet) but it still isn’t working
have I correctly calculated the remaining length?
Did you check this code?
Its written for SIM800L
But packet formations are correct and it works.
Try it and see.
Is your TCP working for any other servers other than MQTT?
Like loading a website or connecting to any sockets?