unsubscribe method
Unsubscribes from channelName, closing its local broadcast controller
and sending an unsubscribe frame to the server if connected.
Implementation
@override
void unsubscribe(String channelName) {
final wasSubscribed = _desiredSubscriptions.remove(channelName);
final hadPresence = _desiredPresenceJoins.remove(channelName) != null;
_presenceStore.remove(channelName);
if (isConnected && (wasSubscribed || hadPresence)) {
send(RealtimeMessage.unsubscribe(channelName));
}
_channelControllers[channelName]?.close();
_channelControllers.remove(channelName);
_channelStreams.remove(channelName);
_presenceControllers[channelName]?.close();
_presenceControllers.remove(channelName);
_presenceStreams.remove(channelName);
}