tungstenite/
lib.rs

1//! Lightweight, flexible WebSockets for Rust.
2#![deny(
3    missing_docs,
4    missing_copy_implementations,
5    missing_debug_implementations,
6    trivial_casts,
7    trivial_numeric_casts,
8    unstable_features,
9    unused_must_use,
10    unused_mut,
11    unused_imports,
12    unused_import_braces
13)]
14
15#[cfg(feature = "handshake")]
16pub use http;
17
18pub mod buffer;
19#[cfg(feature = "handshake")]
20pub mod client;
21pub mod error;
22#[cfg(feature = "handshake")]
23pub mod handshake;
24pub mod protocol;
25#[cfg(feature = "handshake")]
26mod server;
27pub mod stream;
28#[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
29mod tls;
30pub mod util;
31
32const READ_BUFFER_CHUNK_SIZE: usize = 4096;
33type ReadBuffer = buffer::ReadBuffer<READ_BUFFER_CHUNK_SIZE>;
34
35pub use crate::{
36    error::{Error, Result},
37    protocol::{Message, WebSocket},
38};
39
40#[cfg(feature = "handshake")]
41pub use crate::{
42    client::{client, connect},
43    handshake::{client::ClientHandshake, server::ServerHandshake, HandshakeError},
44    server::{accept, accept_hdr, accept_hdr_with_config, accept_with_config},
45};
46
47#[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
48pub use tls::{client_tls, client_tls_with_config, Connector};