pub enum WebsocketConnectionFailureReason {
NetworkInterruption,
ConnectionReset,
ServerTemporaryError,
UnexpectedClose,
StreamEnded,
AuthenticationFailure,
ProtocolViolation,
ConfigurationError,
UserInitiatedClose,
PermanentServerError,
NormalClose,
}Expand description
Represents different types of WebSocket connection failures and their reconnection eligibility
Variants§
NetworkInterruption
Network-level interruption (should reconnect)
ConnectionReset
Connection reset by peer (should reconnect)
ServerTemporaryError
Server temporary error (should reconnect)
UnexpectedClose
Unexpected connection close (should reconnect)
StreamEnded
Stream ended unexpectedly (should reconnect)
AuthenticationFailure
Authentication/authorization failure (should not reconnect)
ProtocolViolation
Protocol violation (should not reconnect)
ConfigurationError
Configuration error (should not reconnect)
UserInitiatedClose
User initiated close (should not reconnect)
PermanentServerError
Permanent server error (should not reconnect)
NormalClose
Normal close (should not reconnect)
Implementations§
Source§impl WebsocketConnectionFailureReason
impl WebsocketConnectionFailureReason
Sourcepub fn from_tungstenite_error(error: &Error) -> Self
pub fn from_tungstenite_error(error: &Error) -> Self
Classifies a tungstenite error into a failure reason
Sourcepub fn from_close_code(code: u16, user_initiated: bool) -> Self
pub fn from_close_code(code: u16, user_initiated: bool) -> Self
Classifies a WebSocket close code into a failure reason
Sourcepub fn should_reconnect(&self) -> bool
pub fn should_reconnect(&self) -> bool
Determines if this failure type warrants a reconnection attempt
Trait Implementations§
Source§impl Clone for WebsocketConnectionFailureReason
impl Clone for WebsocketConnectionFailureReason
Source§fn clone(&self) -> WebsocketConnectionFailureReason
fn clone(&self) -> WebsocketConnectionFailureReason
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for WebsocketConnectionFailureReason
Auto Trait Implementations§
impl Freeze for WebsocketConnectionFailureReason
impl RefUnwindSafe for WebsocketConnectionFailureReason
impl Send for WebsocketConnectionFailureReason
impl Sync for WebsocketConnectionFailureReason
impl Unpin for WebsocketConnectionFailureReason
impl UnwindSafe for WebsocketConnectionFailureReason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more