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")]
16 pub use http;
17 
18 pub mod buffer;
19 #[cfg(feature = "handshake")]
20 pub mod client;
21 pub mod error;
22 #[cfg(feature = "handshake")]
23 pub mod handshake;
24 pub mod protocol;
25 #[cfg(feature = "handshake")]
26 mod server;
27 pub mod stream;
28 #[cfg(all(any(feature = "native-tls", feature = "__rustls-tls"), feature = "handshake"))]
29 mod tls;
30 pub mod util;
31 
32 const READ_BUFFER_CHUNK_SIZE: usize = 4096;
33 type ReadBuffer = buffer::ReadBuffer<READ_BUFFER_CHUNK_SIZE>;
34 
35 pub use crate::{
36     error::{Error, Result},
37     protocol::{Message, WebSocket},
38 };
39 
40 #[cfg(feature = "handshake")]
41 pub 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"))]
48 pub use tls::{client_tls, client_tls_with_config, Connector};
49