Skip to content

Commit

Permalink
close時もリスナーをクリアする、クローズに失敗しても再読込する
Browse files Browse the repository at this point in the history
  • Loading branch information
shiosyakeyakini-info committed Aug 28, 2023
1 parent e430a65 commit 2913789
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/src/services/streaming_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class StreamingService {
}

Future<void> close() async {
streamingChannelControllers.clear();
await Future.wait([
subscription?.cancel() ?? Future.value(),
webSocketChannel.sink.close(),
Expand All @@ -179,7 +180,11 @@ class StreamingService {
}

Future<void> restart() async {
await close();
try {
await close();
} catch (e) {
print("already closed");
}
startStreaming();
}
}

0 comments on commit 2913789

Please sign in to comment.