yuce / teacup_nats

Teacup based NATS client for Erlang
Apache License 2.0
17 stars 9 forks source link

Subscription does not work #13

Closed drasko closed 5 years ago

drasko commented 5 years ago

I have tried subscription here: https://github.com/drasko/mainflux/blob/verne/mqtt/verne/src/mfx_nats.erl#L28

Loop starts and blocks on receive: https://github.com/drasko/mainflux/blob/verne/mqtt/verne/src/mfx_nats.erl#L56 and then never receives anything, although PUB to this topic works fine.

drasko commented 5 years ago

Actually trying example subscription works, so it is probably my error somewhere in plugin implementation:

drasko@Marx:~/test/teacup_nats$ ./examples/sub.escript channel.*
Received teacup_nats msg: {status,connect}
Received NATS msg: {msg,<<"channel.6def78cd-b441-4fd8-8680-af7e3bbea187">>,
                        undefined,
                        <<10,36,54,100,101,102,55,56,99,100,45,98,52,52,49,45,
                          52,102,100,56,45,56,54,56,48,45,97,102,55,101,51,98,
                          98,101,97,49,56,55,26,36,53,53,51,101,52,99,102,48,
                          45,50,57,55,57,45,52,53,99,55,45,97,56,48,101,45,48,
                          49,99,49,53,54,102,56,101,98,55,52,34,4,104,116,116,
                          112,42,22,97,112,112,108,105,99,97,116,105,111,110,
                          47,115,101,110,109,108,43,106,115,111,110,50,166,1,
                          91,123,34,98,110,34,58,34,115,111,109,101,45,98,97,
                          115,101,45,110,97,109,101,58,34,44,34,98,116,34,58,
                          49,46,50,55,54,48,50,48,48,55,54,48,48,49,101,43,48,
                          57,44,32,34,98,117,34,58,34,65,34,44,34,98,118,101,
                          114,34,58,53,44,32,34,110,34,58,34,118,111,108,116,
                          97,103,101,34,44,34,117,34,58,34,86,34,44,34,118,34,
                          58,49,50,48,46,49,125,44,32,123,34,110,34,58,34,99,
                          117,114,114,101,110,116,34,44,34,116,34,58,45,53,44,
                          34,118,34,58,49,46,50,125,44,32,123,34,110,34,58,34,
                          99,117,114,114,101,110,116,34,44,34,116,34,58,45,52,
                          44,34,118,34,58,49,46,51,125,93>>}