setAuthKeyFromDelegate method
Sets a new lifecycle, tries to make request to get
the auth data of type A
.
The fails are handled by _handleAuthFailed
which in its order
emits the channel subscription error using the publicEventEmitter.
Implementation
@protected
Future<void> setAuthKeyFromDelegate() async {
final socketId = connectionDelegate.socketId;
if (socketId == null) {
return;
}
final fixatedLifeCycle = _authRequestLifeCycle;
A? result;
try {
result = await authorizationDelegate.authorizationData(
socketId,
name,
);
if (fixatedLifeCycle < _authRequestLifeCycle) {
return;
}
_authData = result;
} catch (exception, trace) {
if (fixatedLifeCycle < _authRequestLifeCycle) {
return;
}
_handleAuthFailed(exception, trace);
}
}