Giter VIP home page Giter VIP logo

Comments (7)

grutabow avatar grutabow commented on July 20, 2024

@pritstift

mqtt-sn-pub has bug which use topicIdType=0 in publish message. Only topicIdType 1 or 2 is allowedin publish message. To get round this issue, you may use 'short topic'(2 byte topic), for example:

./mqtt-sn-pub -d -d -d -h 127.0.0.1 -p 1884 -q 0 -r -t Hi -m world

For the mqtt-sn subscribe issue, a bug is found. You may try the latest emq-sn develop branch, or wait for next official emqtt release.

You may try my fork of mqtt-sn-tools, which has fixed bugs mentioned above:
https://github.com/grutabow/mqtt-sn-tools

from emqx-sn.

saschathiergart avatar saschathiergart commented on July 20, 2024

Okay. I fiddled a bit around with Version 2.1.1 and 2.1.2. Regarding the subscription everything seems to work.

I'm still having problems with publishing. Reading the MQTT-SN specification v.1.2 i found:

TopicIdType: indicates whether the field TopicId or TopicName included in this message contains a normal topic id (set to “0b00”), a pre-defined topic id (set to “0b01”), or a short topic name (set to “0b10”). The value “0b11” is reserved. Refer to sections 3 and 6.7 for the definition of the various types of topic ids.

Only for QoS = -1, the restriction on topicIdType = {1,2} is actually imposed, as far as i know.

Therefore, I don't think that TopicIdType = 0x00 is a bug in mqtt-sn-pub, when the topic is something long (i.e. more than 2 bytes) and qos ≠ -1. Please correct me if i am wrong at this point.

Furthermore EMQ is printing som errors when i publish a message with mqtt-sn (i don't know whether that is important for this topic):

16:34:23.218 [error] MQTT-SN(127.0.0.1:55355): UNEXPECTED INFO: emit_stats
16:34:23.218 [error] MQTT-SN(127.0.0.1:55355): UNEXPECTED INFO: {subscribe,[{<<"$client/mqtt-sn-tools-62490">>,1}]}

from emqx-sn.

grutabow avatar grutabow commented on July 20, 2024

Regarding MQTT-SN specification v.1.2:

In "5.3.4 Flags", present a general description of TopidIdType:

TopicIdType: indicates whether the field TopicId or TopicName included in this message contains a normal topic id (set to “0b00”), a pre-defined topic id (set to “0b01”), or a short topic name (set to “0b10”). The value “0b11” is reserved. Refer to sections 3 and 6.7 for the definition of the various types of topic ids.

In "5.4.15 SUBSCRIBE", following rule is defined:

TopicIdType: indicates the type of information included at the end of the message, namely “0b00”topic name, “0b01” pre-defined topic id, “0b10” short topic name, and “0b11” reserved.

In "5.4.12 PUBLISH", following rule is defined:

TopicIdType: indicates the type of the topic id contained in the TopicId field.
TopicId: contains the topic id value or the short topic name for which the data is published.

That is to say:

  • SUBSCRIBE allows 3 types of topic: normal topic, pre-defined topic and short topic.
  • PUBLISH allows 2 types of topic: pre-defined topic and short topic.

As you know, PUBLISH is too short to held a normal topic which may be tens bytes long. As a tradeoff, MQTT-SN use a TopicId to represent such a long topic.

Till now, emq-sn does not support Qos -1 which may be implemented later.

These two 'UNEXPECTED INFO' are advanced features of emqttd, and emq-sn does not support them right now. Please ignore them which has no relation with basic subscribe/publish function.

Please don't be hesitate to report any problems you found.

from emqx-sn.

saschathiergart avatar saschathiergart commented on July 20, 2024

Ok that clears some things up. Thanks!

from emqx-sn.

jpmzometa avatar jpmzometa commented on July 20, 2024

Hi, I also have this problem.

All of the MQTT-SN implementation that I have tried so far interpret the specification so that PUBLISH accept 3 topic ID types: normal topic name, pre-defined topic id and short topic name. That is how RSMB, mosquitto, and the official eclipse/paho mqtt-sn libraries (originally written at IBM) work.

Would you please reconsider your interpretation of the specification, and implement the gateway in a manner that is compatible with all other available tools? Otherwise it will create headaches for people trying EMQ for the first time.

from emqx-sn.

grutabow avatar grutabow commented on July 20, 2024

@jpmzometa Next official release will be compatible with "normal topic id" in publish message.

from emqx-sn.

grutabow avatar grutabow commented on July 20, 2024

This change will be released in version 2.2-rc.1.

from emqx-sn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.