Dhanish_Elementz
Dhanish_Elementz

Reputation: 118

How to model MQTT broker to enable clients to subscribe to their messages alone?

I am new to MQTT protocol. I tested the MQTT broker which facilitates the publishing from my android phone and subscription of my IOT actuators(Motors). But I am confused, as how to enable actuators to work only from a particular publisher. In otherwords, I want to control my MotorA from my PhoneA and MotorB from PhoneB and so on... I don't know how to get started outside the localhost(LAN) to make my broker work with the help of internet.

I am using Mosquitto broker and ESP8266 as client. Please share your views on how to get started with Mosquitto broker hosted on internet.

Upvotes: 1

Views: 234

Answers (1)

Marcel Stör
Marcel Stör

Reputation: 23525

Hosted MQTT (e.g. https://www.cloudmqtt.com/) is no different than your local Mosquitto broker except that's in the cloud.

As for how to route publishers you can do that either based on an attribute of the published message e.g. something like motorId or you can publish to different queues. Hence, phone A could publish to queue motor-a and phone B could publish to queue motor-b. The application on the ESP8266 would subscribe to both and act accordingly.

Upvotes: 1

Related Questions