subscribe method

  1. @override
void subscribe()
override

Unlike the public channels, this channel:

  1. Grabs the authorization data of type PrivateChannelAuthorizationData.
  2. Sends the subscription event with the derived data.

See also:

Implementation

@override
void subscribe() async {
  super.subscribe();
  final fixatedLifeCycleCount = startNewAuthRequestCycle();
  await setAuthKeyFromDelegate();
  final currentAuthKey = authData?.authKey;
  if (fixatedLifeCycleCount < authRequestCycle ||
      currentAuthKey == null ||
      state?.status == ChannelStatus.unsubscribed) {
    return;
  }
  connectionDelegate.sendEvent(
    ChannelSubscribeEvent.forPrivateChannel(
      channelName: name,
      authKey: currentAuthKey,
    ),
  );
}