tyler
tyler

Reputation: 1293

How to implement MQTT for one-to-one message distribution

I have been researching MQTT and I am curious how implementation works when trying to create a one-to-one communication system.

What I am trying to do: Set up a system that allows a IOT device to push notifications directly to its user & the user to push notifications to their IOT device via a MQTT broker.

Thoughts on implementation:

  1. All devices have a separate topic that each user is subscribed to.
  2. Each device publishes to the same topic with a tag that identifies the user to pass the message to.

Below is an image I created of how I see the implementation working.

More Info: I need an system that can scale to include 100k+ devices, but extremely low amount of messages(1 message a day)

Layout:

Questions:

Upvotes: 2

Views: 1852

Answers (1)

Michal Foksa
Michal Foksa

Reputation: 12024

I think your concept of understanding MQTT (pub/sub messaging) is incorrect. Every client subscribed to a particular topic gets message. The "tag" you have mentioned (with a tag that identifies the user to pass the message to) is the topic name where the message has to be published.

If you want to do some special message distribution you have to create a client who will be subscribed to a topic where each client sends a message to and then it dispatches the message to particular “client” topic based on value of your “tag”.

Upvotes: 1

Related Questions