Question
When is the LWT being triggered on Client Takeover? When the LWT is not being triggered on Client Takeover?
Answer
As per spec, the will message is published once either the will delay is reached or the session expires.
The shorter of the two is chosen here.
The Server delays publishing the Client's Will Message until the Will Delay Interval has passed or the Session ends, whichever happens first.
Will publishes should not be sent if Session Expiry and Will Delay are both >0.
A client re-connection or client takeover with cleanStart=true
also "ends" any existing session, even if not yet expired, and this must trigger sending the LWT of the previous session.