disconnect

open override fun disconnect()

Disconnects client from a media source and clears the content.

We recommend keeping the connection alive while the content is either visible to the user or the user can quickly return to the previously browsed content.

A possible way is to call connect from Panel.onAddedToFrontend and disconnect from Panel.onRemovedFromFrontend. Since Panel survives configuration changes (such as screen rotation or theme change), it would not call disconnect without reason.

See also