aws / aws-iot-device-sdk-js-v2

Next generation AWS IoT Client SDK for Node.js using the AWS Common Runtime
Apache License 2.0
222 stars 100 forks source link

Topic returning topic filter, not message topic #40

Closed fiLLLip closed 4 years ago

fiLLLip commented 4 years ago

When trying out the sample, and listening to MQTT on a wildcard topic, the topic set in the on_publish is set to the filter, not the actual topic that the message appeared on. How to deal with this, and get the actual topic?

E.g. '$aws/things/+/shadow/update/accepted' should give topic '$aws/things/my_test_device/shadow/update/accepted'

https://github.com/aws/aws-iot-device-sdk-js-v2/blob/4ad3f10b9ef08143b870c892d146dd7d062f3ee1/samples/node/pub_sub/index.ts#L120

Edit: Maybe this should be directed at the https://github.com/awslabs/aws-crt-nodejs project?

KaibaLopez commented 4 years ago

Hi @fiLLLip , Sorry for the lack of response here, i see that you linked a closed issue on crt-nodjs, does that mean you've figure this out? Do you still have other questions?

fiLLLip commented 4 years ago

Yes, I used the .on('message') event instead after subscribing. This supplied the message topic.