MQTTnet
MQTTnet copied to clipboard
how can i know MQTT Server use PublishAsync method to Publish Message to a subscribe client is success?
Describe your question
how can i know MQTT Server use PublishAsync method to Publish Message to a subscribe client is success? When i use PublishAsync() to send a message , how could i know the client received the message ? for example: if there have two client both subscribe a topic, like clientA subscribed topicA and clientB subscribed topicB and now clientA offline and clientB online, when i send a message to these topic on this time, i want to know the message's status. Is there any way to tell me that the message sent to clientA has not been received successfully or that the message sent to client B has been received successfully?
Which project is your question related to?
- Server
What you can do is to give the message an id (or UUID or something) and let the clients publish a message with the received message id on a certain topic the server watches (As a kind of "two-way-handshake").
What you can do is to give the message an id (or UUID or something) and let the clients publish a message with the received message id on a certain topic the server watches (As a kind of "two-way-handshake").
OK, but publisher doesn't have to know what subscribers should get his messages. So we still don't know if each subscriber of the topic did get our message. Is there any option to get list of subscribers of specific topic?
At the momen there is no IP which allows receiving the subscriptions based on a session/connection. I will consider adding it.
In the latest version 4 a new event was added to the server called ClientAcknowledgedPublishPacketAsync. It gets fired whenever a client has acknowledged a PUBLISH packet. The event arguments also provide access to the affected packet.