From 06d131bf3f0d51baa945be5d203e03fde26ed48b Mon Sep 17 00:00:00 2001 From: James Wilson Date: Mon, 21 Jun 2021 14:23:29 +0100 Subject: [PATCH] Add a note about closing ws with statuscode+reason --- backend/shard/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/shard/src/main.rs b/backend/shard/src/main.rs index e4e8d8a..1f7c374 100644 --- a/backend/shard/src/main.rs +++ b/backend/shard/src/main.rs @@ -167,7 +167,9 @@ async fn handle_websocket_connection(websocket: ws::WebSocket, mut tx_to_aggr } } - // loops ended; attempt to close the connection gracefully: + // loops ended; attempt to close the connection gracefully. + // Note: IF we want to close with a status code and reason, we need to construct + // a ws::Message using `ws::Message::close_with`, rather than using this method: let _ = websocket.close().await; }