1

Strange problem when trying to interact with an AWS IoT thing using the mosquitto CLI clients:

  • mosquitto_pub works as I can see the incoming message in the AWS IoT Test console.
  • mosquitto_sub works as I can receive messages sent from the AWS IoT Test console.

However, mosquitto_sub doesn't receive messages sent using mosquitto_pub.

Publisher:

mosquitto_pub --cert krc-test1.cert.pem --key krc-test1.private.key --cafile root-CA.crt -h (endpoint)-ats.iot.us-east-1.amazonaws.com -t topic_1 -m Hello -i basicPubSub

'Hello' will be received in the AWS IoT Test console.

Subscriber:

mosquitto_sub --cert krc-test1.cert.pem --key krc-test1.private.key --cafile root-CA.crt -h (endpoint)-ats.iot.us-east-1.amazonaws.com -t topic_1 -v -i basicPubSub -d

Will receive messages sent from the AWS IoT Test console, but not from the publisher above. Instead, the subscriber will output this ~1 sec after the message is sent:

Client basicPubSub sending CONNECT
Client basicPubSub received CONNACK (0)
Client basicPubSub sending SUBSCRIBE (Mid: 7, Topic: topic_1, QoS: 0)
Client basicPubSub received SUBACK
Subscribed (mid: 7): 0

Anyone has a clue about what might be going on?

Note: I'm using the clientID 'basicPubSub' and the pre-configured topic 'topic_1' for convenience as they are pre-configured in the base policy.

0

You shouldn't use the same client id for both mosquitto apps.

Client id's need to be unique, so you'll have to add a new one to the policy.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.