Skip to content

Commit

Permalink
chore: process ClosedMessage in collect_stored_events
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-orion committed Mar 13, 2024
1 parent a1a7fce commit 5a5a8f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/src/helpers/collect_stored_events.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:nostr_dart/nostr_dart.dart';
import 'package:nostr_dart/src/model/closed_message.dart';

/// Collects stored [EventMessage]s from the provided [NostrSubscription].
///
Expand All @@ -17,11 +18,12 @@ Future<List<EventMessage>> collectStoredEvents(

final StreamSubscription messageListener = subscription.messages.listen(
(event) {
//TODO::process CLOSED when implemented
if (event is EoseMessage) {
completer.complete(event);
} else if (event is EventMessage) {
if (event is EventMessage) {
events.add(event);
} else if (event is EoseMessage) {
completer.complete(event);
} else if (event is ClosedMessage) {
completer.completeError(event.message);
}
},
);
Expand Down

0 comments on commit 5a5a8f4

Please sign in to comment.