MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

how can i know MQTT Server use PublishAsync method to Publish Message to a subscribe client is success?

Open kunlan1949 opened this issue 4 years ago • 3 comments

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

kunlan1949 avatar Jul 22 '21 09:07 kunlan1949

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").

SeppPenner avatar Jul 25 '21 14:07 SeppPenner

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?

elektromntr avatar Aug 02 '21 13:08 elektromntr

At the momen there is no IP which allows receiving the subscriptions based on a session/connection. I will consider adding it.

chkr1011 avatar Sep 05 '21 10:09 chkr1011

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.

chkr1011 avatar Sep 15 '22 07:09 chkr1011