Comments (7)
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.
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.
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.
Ok that clears some things up. Thanks!
from emqx-sn.
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.
@jpmzometa Next official release will be compatible with "normal topic id" in publish message.
from emqx-sn.
This change will be released in version 2.2-rc.1.
from emqx-sn.
Related Issues (20)
- Shutdown due to idle timeout HOT 12
- connection would be destroyed if mqtt-sn client send a 2nd CONNECT in connected state.
- QoS -1 Not Working HOT 1
- Options for transparent and aggregate sn gateway HOT 2
- Empty ClintId on connect HOT 1
- Support of sleeping clients HOT 4
- QoS granted on SUBACK is ignored HOT 2
- Serial port support HOT 1
- Subsequent CONNECTs ignored by gateway
- UNSUBSCRIBE without a payload disconnects the client HOT 4
- qos -1 issue HOT 2
- undefined macro 'SN_RC_MQTT_FAILURE' HOT 7
- Setting the port to ::1:2000 causes error HOT 12
- CONNACK is not always sent to the client HOT 4
- Feature request: Wildcards HOT 4
- Forward to mqtt server HOT 1
- Forwarder encapsulation
- Failure to accept Sn messages with v3 beta HOT 7
- SEARCHGW should always be answered by gateway
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emqx-sn.