Defines comprehensive error types and result wrappers for WebSocket connection, handshake, and framing operations. Use for robust error handling in WebSocket client/server applications.
// Source: https://github.com/snapview/tungstenite-rs | License: Apache-2.0 | Copyright 2017 Alexey Galakhov
// Provided via justclaw.it.com; keep this notice with the code.
//! Error handling.
use std::{io, result, str, string};
use crate::protocol::{frame::coding::Data, Message};
#[cfg(feature = "handshake")]
use http::{header::HeaderName, Response};
use thiserror::Error;
/// Result type of all Tungstenite library calls.
pub type Result<T, E = Error> = result::Result<T, E>;
/// Possible WebSocket errors.
#[derive(Error, Debug)]
pub enum Error {
/// WebSocket connection closed normally. This informs you of the close.
/// It's not an error as such and nothing wrong happened.
///
/// This is returned as soon as the close handshake is finished (we have both sent and
/
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key