MCPcopy Create free account
hub / github.com/Apress/practical-rust-web-projects / on_close

Method on_close

Ch04/websocket/examples/unresponsive_timer.rs:102–111  ·  view source on GitHub ↗
(&mut self, code: CloseCode, reason: &str)

Source from the content-addressed store, hash-verified

100 }
101
102 fn on_close(&mut self, code: CloseCode, reason: &str) {
103 println!(
104 "WebSocket closing for ({:?}) {}",
105 code, reason
106 );
107
108 if let Some(timeout) = self.ping_timeout.take() {
109 self.out.cancel(timeout).unwrap()
110 }
111 }
112}
113
114fn main() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected