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
//! Async WebSocket — adapts nexus-net for async runtimes.
//!
//! The primary API is [`WsReader`] and [`WsWriter`] — sans-IO types
//! that own the frame parser and encoder independently. The transport
//! connection (`conn`) is passed to each call, enabling zero-copy
//! messages and independent read/write borrows.
//!
//! ```ignore
//! let (mut reader, mut writer, mut conn) = WsStreamBuilder::new()
//! .connect("ws://localhost:8080/ws")
//! .await?;
//!
//! while let Some(msg) = reader.recv(&mut conn).await? {
//! match msg {
//! Message::Ping(data) => writer.send_pong(&mut conn, data).await?,
//! Message::Text(text) => {
//! let response = process(text);
//! writer.send_text(&mut conn, &response).await?;
//! }
//! _ => {}
//! }
//! }
//! ```
//!
//! The tokio backend also provides [`WsStream`] — a bundled adapter
//! that implements `futures_core::Stream` and `futures_sink::Sink` for
//! ecosystem compatibility. This uses `OwnedMessage` (allocates per
//! message) and cannot overlap read/write borrows. Use it when you
//! need `StreamExt`/`SinkExt` combinators; use `WsReader`/`WsWriter`
//! for performance-sensitive code.
pub use ;
pub use *;
pub use *;