Device goes offline after 600 seconds without ping



  • Hi,

    after 600 seconds (=10 Minutes) the MQTT-SN-connection is closed by the server, but NB-IoT should be limited to 120 messages a day (1 message every 12 minutes). Is it possible to extend the timeout to 4000 seconds (or more), so the device can be online for about an hour before the MQTT-SN-Gateway closes the connection?

    To establish the connection, I use: 0x1D, 0x04, 0x3D, 0x01, [PING_SEC], [IMSI], [PW]
    PING_SEC can only be up to 0x0258 seconds, if it’s greater, it seems to be set to 0x0258 by the server.

    Or should I ignore the limit of 120 messages per day for the actual tests?

    Best regards
    Tim Sasdrich



  • Hi Tim,

    if you do not intend to transmit or receive data for more than ten minutes, you should use MQTT-SN sleep to keep your session open.

    Best regards,
    Thorsten



  • Hi,

    I want to receive data, if there is any avialable. Normally it’s not, but it could be. So, I think, MQTT-SN sleep isn’t the right solution.

    Best regards
    Tim Sasdrich



  • Hi Tim,

    If the Device wakes up from MQTT-SN Sleep, it will receive all publishes that were sent to device during the sleep.

    BR,
    Kolja



  • @kolja-vornholt Hi,

    Nope, it doesn’t work. QoS 0 is irgnored, QoS 1 didn’t work after reconnect until I PubBack the (guessed) MessageID of the first missing message. Or is there someting wrong?

    Disconnect: 04 18 0E10
    Connect: 1D 04 39 01 012C [IMSI] [PW]



  • @tim-sasdrich: Yes, your message flow is not entirely correct. To get awake, the device has to do the following: “The sleep timer is stopped when the server/gateway receives a PINGREQ from the client. Like the CONNECT message, this PINGREQ message contains the Client Id. The identified client is then in the awake state. If the server/gateway has buffered messages for the client, it will sends these messages to the client. The transfer of messages to the client is closed by the server/gateway by means of a PINGRESP message, i.e. the server/gateway will consider the client as asleep and restart the sleep timer again after having sent the PINGRESP message.” by http://www.mqtt.org/new/wp-content/uploads/2009/06/MQTT-SN_spec_v1.2.pdf , page 26