Component Can't Detect Connection Lost

The component does not detect the connection loss.
The isConnected method always returns true after the first connection.
Published messages do not return any errors.
Once the connection is reestablished, messages that have been "sent" are sent one after the other.
Does anyone know an alternative?