connect
Connects client to a media source to display the content. The connection is kept until disconnect is called.
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.