#[non_exhaustive]pub enum Kind<'a> {
Show 15 variants
Io,
Protocol,
ConnectionClosed,
Closed {
code: Option<u16>,
reason: &'a str,
},
Refused {
status: u16,
retry_after: Option<&'a str>,
},
Url,
HttpFormat,
Tls,
AttackAttempt,
Capacity,
AlreadyClosed,
Unsupported,
ConnectTimeout {
after: Duration,
},
NoAnswer {
after: Duration,
},
Other,
}Expand description
What kind of failure a WsError is.
Matching on it is how a venue classifies, recovers or reports a socket failure without naming tungstenite’s own error. New kinds may be added.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io
The connection’s I/O failed, a TLS EOF included.
Protocol
The peer broke the WebSocket protocol, such as by resetting without a closing handshake.
ConnectionClosed
The connection is closed, after a completed closing handshake.
Closed
The server closed the connection: with a close frame, whose code and reason these are, or by ending the stream with none, which reads as no code and an empty reason. A close frame that carries no code reads the same as no frame.
Fields
Refused
The server refused the WebSocket upgrade with an HTTP status.
Fields
Url
The URL is not a WebSocket URL, or names no host.
HttpFormat
The upgrade request could not be built, such as from an invalid header.
Tls
The TLS configuration was refused, such as an invalid server name. A
certificate the server presents and rustls rejects arrives as
Io.
AttackAttempt
tungstenite detected an attack on the connection.
Capacity
A message or a header block was larger than the configured limits.
AlreadyClosed
The connection was used after it closed.
Unsupported
The transport cannot perform the operation, such as a handshake header
or a control frame on a transport that has none. A transport reports it
as an I/O error of kind std::io::ErrorKind::Unsupported, so reconnecting
never fixes it.
ConnectTimeout
The connection did not open within the connect timeout.
NoAnswer
No answer arrived within the answer timeout.
Other
Any other transport failure: a full write buffer, a frame that is not valid UTF-8, or a failure a later tungstenite adds.