pub fn write_close(
stream: &mut dyn Write,
code: u16,
reason: &str,
) -> Result<()>Expand description
Write a close frame carrying a status code and a reason, then flush.
1000 is a normal close; 1001 is “going away”, which is what a server that is shutting down means.