-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How Broker can send a message back to a publisher ? #15
Comments
The broker can also publish a message with a topic and if the client has subscribed for that topic, it will receive it. In MQTT there is no concept of a direct reply, but it is all done via pub/sub on topics, If you look into the sample code: in line 86 there is a publish of the broker. If your client subscribes with: |
Thank you Martin-ger, i understand the concept of pub/sub on topics but why we can't use the "Client" object ? |
The client object uses a TCP/IP link to the broker. As this broker is on the local ESP, the standard TCP/IP stack doesn't allow for a loopback connection. I build a lwip-version that can support this, but it requires much more ressources than simply using the direct local pub and sub calls. Hope, this explains. |
Another time thank you for your support. |
Hello, thirst thank you for sharing this code who is very useful. I have a question, how the broker could response to the publisher (who isn't on the local network ) because i don't see any reference to the "client".
for example a mosquito "client" send this
mosquitto_pub -m "Relay ON" -t "/MyMQTT_Sub" -h "192.168.1.96"
The broker well receive the message
and now i want to send back (from the broker) a acknowledge message like "OK the Relay is switch ON".
thank you for your response
The text was updated successfully, but these errors were encountered: