1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Suppress missing_errors_doc for the entire crate - error documentation is centralized in the error module
//! stream-tungstenite: WebSocket client with automatic reconnection.
//!
//! This library provides a robust WebSocket client that handles:
//! - Automatic reconnection with configurable retry strategies
//! - Application-level handshakes (authentication, subscriptions)
//! - Extension system for lifecycle and message handling
//! - Connection state management and monitoring
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use stream_tungstenite::{WebSocketClient, ClientConfig};
//! use std::sync::Arc;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create client with builder pattern
//! let client = WebSocketClient::builder("wss://example.com/ws")
//! .receive_timeout(std::time::Duration::from_secs(30))
//! .build();
//!
//! // Subscribe to messages before running
//! let mut messages = client.subscribe();
//!
//! // Run client in background
//! let client = Arc::new(client);
//! tokio::spawn({
//! let client = client.clone();
//! async move { client.run().await }
//! });
//!
//! // Receive messages
//! while let Ok(msg) = messages.recv().await {
//! println!("Received: {:?}", msg);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────┐
//! │ WebSocketClient │
//! │ - High-level API for WebSocket connections │
//! │ - Automatic reconnection with retry strategies │
//! │ - Message broadcasting via channels │
//! └─────────────────────────────────────────────────────────────────┘
//! │
//! ┌───────────────────┼───────────────────┐
//! ▼ ▼ ▼
//! ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
//! │ Handshake │ │ Extension │ │ Connection │
//! │ - Auth │ │ - Lifecycle │ │ - State │
//! │ - Subscribe │ │ - Messages │ │ - Retry │
//! │ - Chained │ │ - Logging │ │ - Supervisor │
//! └─────────────────┘ └─────────────────┘ └─────────────────┘
//! ```
// Core modules
// Layer modules
/// Re-export tokio-tungstenite types
/// Prelude for convenient imports
// Re-export main types at crate root
pub use ;
pub use ConnectionEvent;
pub use ;
pub use SharedMessage;