njh / ruby-em-mqtt-sn

MQTT-SN protocol and gateway support for EventMachine
http://rubygems.org/gems/em-mqtt-sn
MIT License
10 stars 1 forks source link

wildcard topics lead to invalid topic ids #2

Open mknj opened 11 years ago

mknj commented 11 years ago

The received topic ids change for wildcard subscriptions. (tested with mqtts-sub.c)

If features are unsupported, please list them in the readme.

change mqtts-sub.c to see the topic_id:

    -   printf("%s\n", packet->data); 
    +  printf("%i %i %s\n", packet->topic_id, packet->message_id, packet->data);

output: $ mqtts-sub -t '$SYS/#' 512 0 mosquitto version 0.15 768 0 2013-01-09 05:15:05+0000 1024 0 $Revision: e745e1ab5007 $ 1280 0 8506 seconds 1536 0 20 1792 0 251 2048 0 1033 2304 0 0 2560 0 0 2816 0 0 3072 0 0 3328 0 0 3584 0 2 3840 0 3972 bytes 4096 0 5948 bytes

njh commented 11 years ago

Hello,

I suspect you meant to report this here: https://github.com/njh/mqtts-tools/issues

No, knowing the topic that a message was published to in a wildcard subscription is not currently supported by mqtts-sub. I will update the documentation.

A patch would be very welcome - but it probably needs a data-structure (a linked list?) added to keep track of the topic id mapping.

nick.

mknj commented 11 years ago

Hi nick, just found " # FIXME: send register if this is a new topic" in the rb code. I can update the client code, if you fix the gateway code.

Markus

njh commented 11 years ago

Yes, sorry, I meant to say that I didn't think it was properly supported in the gateway either.

Shouldn't be too much work...