Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ws server terminate subscriptions when connection is closed by the client. #483

Merged
merged 16 commits into from
Sep 24, 2021
Merged
2 changes: 1 addition & 1 deletion tests/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,5 +334,5 @@ async fn ws_server_should_stop_subscription_after_client_drop() {
assert_eq!(res.as_ref(), Some(&1));
drop(client);
// assert that the server received `SubscriptionClosed` after the client was dropped.
assert!(rx.next().await.is_some());
assert!(matches!(rx.next().await.unwrap(), SubscriptionClosedError(_)));
niklasad1 marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 1 addition & 1 deletion ws-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,6 @@ async fn background_task(
}
}

// Send WebSocket close reason to the server (this might fail if the server already terminated the connection).
// Send close message to the server.
let _ = sender.close().await;
}