moquette-io / moquette

Java MQTT lightweight broker
http://moquette-io.github.io/moquette/
Apache License 2.0
2.32k stars 818 forks source link

onConnectionLost #868

Closed Yunustt closed 1 week ago

Yunustt commented 3 weeks ago

I have a question. netty detects inactivity and logs out.Why do I need to trigger onConnectionLost after broker onDisconnect

andsel commented 1 week ago

@Tong-07 do you mean that after the broker processes a DISCONNECT message your code gets notified of connection lost?

Yunustt commented 1 week ago

yes

andsel commented 1 week ago

It's because after DISCONNECT the client or the broker closes the connection, and Netty notifies the lost connection.

Yunustt commented 1 week ago

I think if the client actively disconnects, is it better for the broker to use a callback listening, netty's notification I understand