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
//! WebSocket client for real-time market data and user updates.
//!
//! # Overview
//!
//! This module provides a WebSocket client for connecting to the Coinbase Advanced Trade
//! WebSocket API. It supports both public channels (market data) and authenticated user
//! channels (order updates, fills, etc.).
//!
//! # Example
//!
//! ```no_run
//! use coinbase_advanced::ws::{WebSocketClient, Channel};
//! use futures::StreamExt;
//!
//! #[tokio::main]
//! async fn main() -> coinbase_advanced::Result<()> {
//! // For public data only
//! let client = WebSocketClient::builder()
//! .build()?;
//!
//! // Connect and subscribe
//! let mut stream = client.connect().await?;
//! client.subscribe(&[Channel::Ticker {
//! product_ids: vec!["BTC-USD".to_string()],
//! }]).await?;
//!
//! // Listen for messages
//! while let Some(msg) = stream.next().await {
//! println!("Received: {:?}", msg);
//! }
//!
//! Ok(())
//! }
//! ```
pub use ;
pub use ;
pub use *;