Android Question MQTT Chat with Auto Discovery - Multiple custom subscriptions per client

Lakhtin_V

Active Member
Licensed User
Longtime User
It is possible to use multiple user subscriptions per client. I want to be able to receive different types of messages, my task is wider than just chat. The client must receive different objects and process them differently.
MQTT autodiscovery:
Private Sub client_Connected (Success As Boolean)
    If Success=True Then
        client.Subscribe("all/#", 0)       
        client.Subscribe("time", 0)
        client.Subscribe("signal", 0)
        client.Publish2("all/connect", serializator.ConvertObjectToBytes(Name), 0, False)

Private Sub client_MessageArrived (Topic As String, Payload() As Byte)
    Dim receivedObject As Object
    receivedObject = serializator.ConvertBytesToObject(Payload)
    Select Topic
        Case "all/connect", "all/disconnect"
        ....
        Case "time"
        ....
        Case "signal"
        ....

How a client can address a message to another specific client, I have not found an example anywhere. For example, only a broker client. Or broker specific client
 

teddybear

Well-Known Member
Licensed User
How a client can address a message to another specific client, I have not found an example anywhere. For example, only a broker client. Or broker specific client
A client can publish a specific topic and another specific client subscribles the topic
 
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
A client can publish a specific topic and another specific client subscribles the topic
For my task, it is important that the client can receive different information from different objects. To process different objects, client must have different subscriptions.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
For my task, it is important that the client can receive different information from different objects. To process different objects, client must have different subscriptions.
It's not necessary to process different objects client must have different subscriptions. you can encapsulate different objects into one payload using one topic
 
Upvote 0

Lakhtin_V

Active Member
Licensed User
Longtime User
It's not necessary to process different objects client must have different subscriptions. you can encapsulate different objects into one payload using one topic
If there is one topic and one subscription, how then can the client automatically process different objects, it turns out that the first object should act as a topic? But this is not convenient and therefore it is not clear why arbitrary topics cannot be used.
 
Upvote 0
Top