I have an embedded Linux platform which uses an nRF9160 connected via UART. The nRF9160 has been loaded with the serial LTE modem firmware, version 1.3.1.
I've been experimenting with the AT command for MQTT. So far, I've been able to set up the necessary credentials and connect to my AWS account. I have also been able to publish MQTT messages, only HEX and ASCII. If I send a JSON message, the firmware generates an error -- It doesn't attempt to send out LTE, it seems to just error before that. However, I've been able to encode JSON into a hex message and send that way -- AWS actually interprets this as JSON.
Today, I was attempting to demo the MQTT subscribe. When I do this, I get an unexpected response, and the connection to AWS terminates. My security profile for publish and subscribe are the same, but I can't subscribe. I am using a Linux system for this. I've provided some example output for some helper tools I've written.
root@beaglebone:~/swedar_sirius_linux/build# ./mqtt_connect 1 client-lte a3g5x5to9ttni4-ats.iot.us-west-2.amazonaws.com 8883 1984
~~~~~
OK<CR><LF>
#XMQTTEVT: 0,0<CR><LF>
~~~~~
Connected
root@beaglebone:~/swedar_sirius_linux/build# ./lte AT#XMQTTCON?
#XMQTTCON: 1,"client-lte","a3g5x5to9ttni4-ats.iot.us-west-2.amazonaws.com",8883,1984
OK
root@beaglebone:~/swedar_sirius_linux/build# ./mqtt_subscribe -t swedar-full -q 0
command = AT#XMQTTSUB="swedar-full",0
#XMQTTEVT: 9,0<CR><LF>
Timeout!
Timeout!
The `XMQTTEVT` that occurs here with this tool is not anywhere in the docs. I don't know what this means outside of it didn't work.
For this next setup, I connected the same as before, and published a message just to see it was working, then I tried the subscribe another way.
root@beaglebone:~/swedar_sirius_linux/build# ./mqtt_connect 1 client-lte a3g5x5to9ttni4-ats.iot.us-west-2.amazonaws.com 8883 1984
~~~~~
OK<CR><LF>
#XMQTTEVT: 0,0<CR><LF>
~~~~~
Connected
root@beaglebone:~/swedar_sirius_linux/build# ./mqtt_publish -t swedar-full -d test.txt -q 1
command = AT#XMQTTPUB="swedar-full",1,"Hello from Sirius!",1,0
~~~~~
OK<CR><LF>
#XMQTTEVT: 3,0<CR><LF>
~~~~~
Message acknowledged
root@beaglebone:~/swedar_sirius_linux/build# ./lte -z AT#XMQTTSUB=\"swedar-full\",0
OK
#XMQTTEVT: 1,-128
This indicates the connection is gone. What is the error code? Any idea why the subscribe command would error?