The online/offline messages are simply standard "mqtt last will and testament" messages.
A brief explanation can be found here.
Depending a little bit on what exactly interrupted the connection, there may be some expected delays.
Eg. if a sudden power outage happens, the server broker can't immediately detect the broken link and there will be a slight delay up to the set keep alive interval.
If you manually shut down the broker, you won't get any "LWT" as it is called.
If you kill the client broker (unclean shutdown), you might get an offline message quicker.