The cloud knows a device is online because it has a continuous connection with the cloud. So long as that connection is intact, it will show as “online”. Once you break that connection, the cloud doesn’t know whether that it because it simply isn’t broadcasting anything for a bit, or because you pulled the plug. As such, there’s a timeout on the connection, after which it will show “offline”.
Going online is much quicker since the device can basically say:“here I am”, while it cannot say “hey, I’m gone” if the power drops.