MQTT-SN protocol gateway

    The biggest difference of MQTT-SN is that Topic uses TopicId instead, and TopicId is a 16-bit number. Each number corresponds to one Topic, device and cloud need to use the REGISTER command to map the correspondence between TopicId and Topic.

    MQTT-SN can change the content of Will at any time, or even cancel it. MQTT only allows the content of Will to be set during CONNECT. And no changes are allowed.

    There is a gateway device in the MQTT-SN network, which is responsible for converting MQTT-SN into MQTT and communicating with the MQTT Broker in the cloud. MQTT-SN The protocol supports the function of automatically discovering the gateway.

    MQTT-SN also supports the sleep function of the device. If the device enters the sleep state and cannot receive UDP data, the gateway will set the downstream PUBLISH The message is buffered and sent until the device wakes up.

    EMQX-SN is a gateway access module of EMQX, which implements most of the functions of MQTT-SN. It is equivalent to an MQTT-SN gateway in the cloud, directly interacting with EMQ X Broker is connected.

    Create module

    Select MQTT-SN to access the gateway module:

    image-20200927213049265

    Configure related basic parameters:

    image-20200927213049265

    Configure monitoring parameters:

    Click to confirm to the configuration parameter page:

    image-20200927213049265

    MQTT-SN client library

    1. https://github.com/eclipse/paho.mqtt-sn.embedded-c/ (opens new window)
    2. https://github.com/arobenko/mqtt-sn (opens new window)