How do I access the Server, which clients are connected and what are their subscriptions?
Or some method that returns me to that topic which clients will be sent the message.
You can create a server following the Wiki under https://github.com/chkr1011/MQTTnet/wiki/Server.
You can easily get all the clients that connect at one time and store them in a List or whatever using the WithConnectionValidator method following https://github.com/chkr1011/MQTTnet/wiki/Server#validating-mqtt-clients.
You can get all messages on the server if you implement the WithApplicationMessageInterceptor method following https://github.com/chkr1011/MQTTnet/wiki/Server#intercepting-application-messages. There, you can map client ids to the connected client ids from your List or whatever as mentioned above.
You can also make use of the client status API at the server.
From what I have looked for there is no api that can bring all the subscription of a client for example. The only way I found was to make myself a list with all connections made and store within each connection, another list with the subscription. In other words, to hide more memory. Since this information already exists on the server itself.
What would be the API that I could use to access the information?
GetSessionStatusAsync(): This method only returns the sessions if details. Only the ClientId, how many messages in the queue, and two methods one to clear the messages in the queue and another to delete the session.
No information about subscriptions.
GetClientStatusAsync(): This method does not return connection details, statistics other things like disconnect. No information about subscriptions.
The class I have not seen anywhere to access and which contains the subscriptions is the MqttClientSubscriptionsManager
Yes you are right. At the moment there is nothing more possible. So you have to use the interceptors to fill your own dictionaries or whatever with that data.
But I assume this feature will be added to 3.1.x+ of this library.
From what I have looked for there is no api that can bring all the subscription of a client for example. The only way I found was to make myself a list with all connections made and store within each connection, another list with the subscription.
That was the way I would have done it as well.
I will treat this as a feature request^^
I used GetClientStatusAsync in the latest 2.x branch. I create a topic to get this info from a manager client, but there is an issue. If a client as soon as connected, it's reported by GetClientStatusAsync but after a while not also if still connected. Why?
You can also make use of the client status API at the server.
Which? I use 2.8.5v
You can also make use of the client status API at the server.
Which API?
I don't remember it completely but in 2.8.5 there should be something like "GetConnectedClients" or similar available at the server interface.