Skip to main content

bybit_rust_api/ws/
mod.rs

1//! WebSocket module for Bybit V5 real-time data streams.
2//!
3//! Provides connection management, authentication, and typed data
4//! structures for all Bybit WebSocket channels.
5//!
6//! # Quick Start
7//!
8//! ```ignore
9//! use bybit_rust_api::ws::{WsClient, topics};
10//! use futures_util::StreamExt;
11//!
12//! #[tokio::main]
13//! async fn main() -> anyhow::Result<()> {
14//!     let client = WsClient::connect(
15//!         "wss://stream.bybit.com/v5/public/linear"
16//!     ).await?;
17//!
18//!     client.subscribe(vec![
19//!         topics::orderbook(1, "BTCUSDT"),
20//!         topics::trade("BTCUSDT"),
21//!         topics::kline("1", "BTCUSDT"),
22//!     ]).await?;
23//!
24//!     while let Some(msg) = client.next().await {
25//!         println!("Topic: {:?}", msg.topic());
26//!     }
27//!     Ok(())
28//! }
29//! ```
30
31pub mod auth;
32pub mod client;
33pub mod messages;
34pub mod private;
35pub mod public;
36pub mod trade;
37
38// Re-export key types
39pub use auth::generate_auth_params;
40pub use client::WsClient;
41pub use messages::{topics, WsMessage, WsOpResponse, WsRequest, WsResponse};