This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MQTT Subscribe And Unsolicited Messages

Good day I am wondering if anyone can help me

For background information.

Network - NB-iot

Firmware -  1.3.1

Software - Serial LTE Modem

Hardware - nrf9160dk

I have two questions related to MQTT specifically the MQTT Subscribe.

1) When I subscribe to a MQTT topic and get the message that was published with a retain flag the next time I make a MQTT connection, the modem is still "subscribed" as the subscription message will be the first thing to come out of the modem. 

2) When I subscribe to a topic the subscription will always be the oldest record published, even if newer data has been published then the modem always get the first record and never updates to the latest data that has been published. Please look at time stamps on both photos. I published the second message before the MQTT connection was made. Even if i do re-subscribe to the topic I do not get the latest topic. 

(15:33:18.930) AT+CGDCONT?
 (13)
(15:33:19.008) 
 (2)
(15:33:19.008) +CGDCONT: 0,"IP","lte.vodacom.za","100.91.73.38",0,0
 (54)
(15:33:19.248) OK
 (4)
(15:35:26.411) AT#XMQTTCON=1,"30011","","","broker.hivemq.com",1883
 (54)
(15:35:29.368) 
 (2)
(15:35:29.384) OK
 (4)
(15:35:30.134) 
 (2)
(15:35:30.152) #XMQTTEVT: 0,0
 (16)
(15:35:33.194) AT#XMQTTSUB="TestTopic/Test/3022",2
 (37)
(15:35:33.359) 
 (2)
(15:35:33.375) OK
 (4)
(15:35:35.226) 
 (2)
(15:35:35.226) #XMQTTEVT: 7,0
 (16)
(15:35:35.370) 
 (2)
(15:35:35.386) #XMQTTMSG: 19,31
 (18)
(15:35:35.466) TestTopic/Test/3022
 (21)
(15:35:35.545) {
This is the First Publish
}$

 (33)
(15:35:35.689) 
 (2)
(15:35:35.707) #XMQTTEVT: 2,0
 (16)
(15:35:40.001) AT#XMQTTUNSUB="TestTopic/Test/3022"
 (37)
(15:35:40.176) 
 (2)
(15:35:40.176) OK
 (4)
(15:35:42.252) 
 (2)
(15:35:42.275) #XMQTTEVT: 8,0
 (16)
(15:35:43.893) AT#XMQTTCON=0
 (15)
(15:35:43.976) 
 (2)
(15:35:43.976) #XMQTTEVT: 1,0
 (16)
(15:35:44.067) 
 (2)
(15:35:44.067) OK
 (4)
(15:36:13.328) AT#XMQTTCON=1,"30011","","","broker.hivemq.com",1883
 (54)
(15:36:15.445) 
 (2)
(15:36:15.474) OK
 (4)
(15:36:15.956) 
 (2)
(15:36:15.956) #XMQTTEVT: 0,0
 (16)
(15:36:16.083) 
 (2)
(15:36:16.083) #XMQTTMSG: 19,31
 (18)
(15:36:16.166) TestTopic/Test/3022
 (21)
(15:36:16.288) {
This is the First Publish
}$

 (33)
(15:36:16.415) 
 (2)
(15:36:16.415) #XMQTTEVT: 2,0
 (16)
(15:36:18.177) AT#XMQTTSUB="TestTopic/Test/3022",2
 (37)
(15:36:18.350) 
 (2)
(15:36:18.350) OK
 (4)
(15:36:19.979) 
 (2)
(15:36:20.011) #XMQTTEVT: 7,0
 (16)
(15:37:20.139) 
 (2)
(15:37:20.155) #XMQTTEVT: 9,0
 (16)
(15:38:20.284) 
 (2)
(15:38:20.284) #XMQTTEVT: 9,0
 (16)
(15:39:20.428) 
 (2)
(15:39:20.444) #XMQTTEVT: 9,0
 (16)
(15:40:19.981) 
 (2)
(15:40:19.997) #XMQTTEVT: 9,0
 (16)
(15:41:20.142) 
 (2)
(15:41:20.142) #XMQTTEVT: 9,0
 (16)
(15:42:20.270) 
 (2)
(15:42:20.286) #XMQTTEVT: 9,0
 (16)
(15:44:03.442) 
 (2)
(15:44:03.442) #XMQTTEVT: 1,-113
 (19)

Related