eclipse / paho.mqtt.python

paho.mqtt.python
Other
2.19k stars 721 forks source link

cannot subscribe that I published on same topic #680

Closed liutheuniverse closed 9 months ago

liutheuniverse commented 2 years ago

environment: visual studio code=1.71.2 python=3.8 paho.mqtt=1.6.1

I changed my picture into base64 and published it, but when I subscribed to the base64 number under the same topic, it did not get the base64, so how should I solve it MQTT.zip

ralight commented 1 year ago

Your publishing client must call loop_start() or loop_forever(), to ensure the message is actually sent - you could exit in an on_publish callback.

Your subscribing client doesn't set the on_message callback until you call subscribe(), so it is faintly possible, although very unlikely, that the message is received before the on_message callback is set. I suspect the problem is in the publisher.

MattBrittan commented 9 months ago

Closing this due to inactivity (assume Rogers answer helped).

Note: This is part of an exercise to clean up old issues so that the project can move forwards. Due to the number of issues being worked through mistakes will be made; please feel free to reopen this issue (or comment) if you believe it's been closed in error.