Unnecessary Topic registration?


  • According to the MQTT-SN specifiction a topic name must be registered before some values can be published for the topic. In order to save data during transmissions, the registration should be made only once. In practice, a new topic registration is required after every connect to the CoT. I tried the following:

    (a) Used the “sleep mode” as defined in the MQTT-SN specification. The device performs a disconnect with a duration of e.g. 15min. But when connecting again after 5min, a publish without a new topic registration results in a reject error (for an invalid topic id).

    (b) The disconnect could be omitted. After connecting and registering the topics, the device could simply send publish messages in (more or less) fixed intervals. But even when declaring a keep alive duration of 15min in the connect message, an attempt to publish a new value 5min after the last one leads to a failure. The MQTT-SN gateway sends a disconnect on an attempt to publish new values.

    This foils the goal of the MQTT-SN specification to save bandwidth. How does the CoT expect a device to behave in order to use one topic registration for multiple publish operations over a reasonable period of time?



  • I followed your described scenarios a) and b) and cannot reproduce your observations.

    a) works fine for me as long as the actual sleep duration is below the one that was set by the disconnect message. Otherwise the device will get a Disconnect message and the topic registry is gone.

    b) works also fine for me.

    This is why I have two additional comments:

    Beware of the fact that all timers are given in seconds. So for example a sleep duration of 0x012C (=300 in decimal) is equivalent to a 5 min sleep duration.

    Please make sure that nobody else (e.g. colleague that is testing at the same time) is currently using the same clientID. If a second client connects with the same clientID, the first one will get disconnected.

    Best regards


 

Looks like your connection to Internet of Things was lost, please wait while we try to reconnect.