Ikarus
Ikarus

Reputation: 1193

MQTT - Publish a message to many independent topics

In MQTT, A Client can subscribe to a Topic Name or a Topic Wildcard. A message can be published to a topic or some topics with the same wildcard. But how to publish a message to some topic which are independent to each other? Do I need to modify MQTT Protocol?

For Example: My server handle connections from 10 clients(these client do not relate to each other) with the ids : client1, client2, ..., client 10, and client1 want to send a message to an arbitrary number of clients(e.g. client 3, client 7, client8)

Upvotes: 0

Views: 10789

Answers (1)

hardillb
hardillb

Reputation: 59866

You can only publish to a specific topic, not a wildcard topic or to a client id.

Subscriptions can be to wild card or specific topics.

Multiple clients can subscribe to the same topics so if you want to send a message to a group of clients then you just need to pick a topic they are all subscribed to. Or there is nothing to stop you publishing the same message to multiple topics in sequences.

Upvotes: 7

Related Questions