File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
lib/src/links/websocket_link Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -495,7 +495,19 @@ class SocketClient {
495495 .where ((message) => message is SubscriptionComplete )
496496 .take (1 );
497497
498- subscriptionComplete.listen ((_) => response.close ());
498+ subscriptionComplete.listen (
499+ (_) => response.close (),
500+ onDone: () {
501+ if (! config.autoReconnect) {
502+ response.close ();
503+ }
504+ },
505+ onError: (_) {
506+ if (! config.autoReconnect) {
507+ response.close ();
508+ }
509+ },
510+ );
499511
500512 dataErrorComplete
501513 .where ((message) => message is SubscriptionData )
Original file line number Diff line number Diff line change @@ -613,7 +613,8 @@ Future<void> main() async {
613613 operation: Operation (document: gql ('subscription {}' )),
614614 );
615615 final waitForConnection = true ;
616- socketClient.subscribe (payload, waitForConnection);
616+ var subscription = socketClient.subscribe (payload, waitForConnection);
617+ var isEmpty = subscription.isEmpty;
617618
618619 await expectLater (
619620 socketClient.connectionState,
@@ -638,6 +639,8 @@ Future<void> main() async {
638639
639640 expect (
640641 socketClient.socketChannel! .closeCode, WebSocketStatus .normalClosure);
642+
643+ expect (await isEmpty.timeout (const Duration (seconds: 1 )), true );
641644 });
642645 }, tags: "integration" );
643646
You can’t perform that action at this time.
0 commit comments