subscribe method
Unlike the public channels, this channel:
- Grabs the authorization data of type PrivateEncryptedChannelAuthorizationData.
- Sends the subscription event with the derived data.
- Shared secret is accessible from authData for further internal decryption of the event data.
See also:
- EndpointAuthorizableChannelAuthorizationDelegate
EndpointAuthorizableChannel
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.forPrivateEncryptedChannel(
channelName: name,
authKey: currentAuthKey,
),
);
}