We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Lighthouse::close
1 parent 03174b4 commit 1ad4f39Copy full SHA for 1ad4f39
lighthouse-client/src/lighthouse.rs
@@ -295,4 +295,11 @@ impl<S> Lighthouse<S>
295
pub fn authentication(&self) -> &Authentication {
296
&self.authentication
297
}
298
+
299
+ /// Closes the WebSocket connection gracefully with a close message. While
300
+ /// the server will usually also handle abruptly closed connections
301
+ /// properly, it is recommended to always close the [``Lighthouse``].
302
+ pub async fn close(&self) -> Result<()> {
303
+ Ok(self.ws_sink.lock().await.close().await?)
304
+ }
305
0 commit comments