subscribe method
Unlike the public channels, this channel:
- Grabs the authorization data of type PresenceChannelAuthorizationData.
- Sends the subscription event with the derived data.
See also:
- EndpointAuthorizableChannelAuthorizationDelegate
EndpointAuthorizableChannel
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,
),
);
}