mapEventToState method
Implementation
@override
Stream<BoraPushState> mapEventToState(BoraPushEvent event) async* {
if (event is ConnectEvent) {
try {
_pushClient = BoraPushClient.connect(
uri: event.uri,
withCredentials: event.withCredentials,
closeOnError: event.closeOnError,
);
yield ConnectedState(_pushClient.stream);
} catch (e) {
yield ErrorState('Failed to connect: $e');
}
} else if (event is CloseEvent) {
_pushClient.close();
yield ClosedState();
}
}