On Tue, Mar 3, 2015 at 8:37 AM, Henry John <
qhlonl...@gmail.com> wrote:
> fix.
> 2、The client will always set 'clean session' as true, so after its lost
> connect, the session is removed. But the publisher will set message tag as
> 'retained', so after the client reconnect and subscribe with the same
> client_id, It will also receive messages published to it.
In this case when the client reconnects it will only receive the last
message published to the topic. There is only ever one retained
message per topic.
Something else to bear in mind - you can use the "will" of a client to
remove retained messages. Set the will topic as appropriate, set the
will retained flag to true and will payload to be empty and if the
client unexpectedly disconnects (i.e. without sending a DISCONNECT),
the retained message at the will topic will be cleared.
Cheers,
Roger