handleOtherExternalEvents method
Emits the event using publicEventEmitter if it managed to decrypt the event data successfully.
Implementation
@override
void handleOtherExternalEvents(ChannelReadEvent readEvent) {
final sharedSecret = authData?.sharedSecret;
if (readEvent.name.contains(Channel.pusherInternalPrefix) ||
sharedSecret == null) {
return;
}
String? errorMessage;
dynamic arosedException;
StackTrace? stackTrace;
try {
publicEventEmitter(
ChannelReadEvent.fromPusherChannelsReadEvent(
this,
readEvent.copyWithDecryptedData(
key: sharedSecret,
encodeDelegate: eventDataEncodeDelegate,
),
),
);
return;
} on PusherChannelsException catch (exception, trace) {
stackTrace = trace;
arosedException = exception;
errorMessage = exception.message;
} catch (exception, trace) {
stackTrace = trace;
arosedException = exception;
errorMessage = 'Failed to process the encrypted event';
}
errorMessage =
'$errorMessage\nChannel:$name\nException:$arosedException\nTrace:$stackTrace';
PusherChannelsPackageLogger.log(errorMessage);
}