subscribe method

  1. @override
void subscribe()
override

Unlike the public channels, this channel:

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

See also:

Implementation

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