MCPcopy Create free account
hub / github.com/Botloader/botloader / close

Method close

components/webapi/src/routes/ws.rs:129–145  ·  view source on GitHub ↗
(&mut self, reason: WsCloseReason)

Source from the content-addressed store, hash-verified

127 }
128
129 async fn close(&mut self, reason: WsCloseReason) {
130 if matches!(reason, WsCloseReason::ClientDisconnected) {
131 // connection is already closed
132 return;
133 }
134
135 let code = reason.code();
136 let desc = reason.description();
137
138 self.socket
139 .send(Message::Close(Some(CloseFrame {
140 code,
141 reason: Cow::from(desc),
142 })))
143 .await
144 .ok(); // we don't really care about the error here
145 }
146
147 async fn handle_ws_message(&mut self, msg: Message) -> WsResult {
148 match msg {

Callers

nothing calls this directly

Calls 3

codeMethod · 0.80
descriptionMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected