A versatile websocket client that supports many cryptocurrency exchanges.
```rust use cryptowsclient::{BinanceSpotWSClient, WSClient};
async fn main() { let (tx, rx) = std::sync::mpsc::channel(); tokio::task::spawn(async move { let symbols = vec!["BTCUSDT".tostring(), "ETHUSDT".tostring()]; let wsclient = BinanceSpotWSClient::new(tx, None).await; wsclient.subscribetrade(&symbols).await; // run for 5 seconds let _ = tokio::time::timeout(std::time::Duration::fromsecs(5), wsclient.run()).await; wsclient.close(); });
for msg in rx {
println!("{}", msg);
}
} ```