In my Node-RED flow, I have wired an IBM IoT Input node to an IBM IoT Output node. I am using mosquitto_pub
on command line to publish to WIoTP so that the Node-RED flow is started. Similarly, I am using mqtt sub
(from mqttjs) to subscribe to the message from the Node-RED flow. However, I am not receiving payload on my subscription terminal window.
Publish
mosquitto_pub -h orgId.messaging.internetofthings.ibmcloud.com -p 8883 -i d:orgId:dType:default -u use-token-auth -P 'authToken' --cafile messaging.pem -t iot-2/evt/data/fmt/json -f payload.json
Subscribe
mqtt sub -h orgId.messaging.internetofthings.ibmcloud.com -p 443 -l wss -i a:orgId:default_mobile -u API-key -P 'API-token' --ca messaging.pem -t iot-2/type/mobile/id/default_mobile/evt/live/fmt/json
For subscription, I have created API keys and am using the same. What am I missing?
the subscription topic seems to be incorrect. If your device is publishing in
iot-2/evt/data/fmt/json
then you should subscribe to
iot-2/type/mobile/id/default_mobile/evt/data/fmt/json
Note: mind data instead of live