Struct bitsors::websocket::BitsoWebSocket  [−][src]
pub struct BitsoWebSocket { /* fields omitted */ }Expand description
Bitso WebSocket object.
For more info see: https://bitso.com/api_info?#websocket-api
Check all the possible options in Books and Subscription
Examples
use bitsors::websocket::*;
let mut socket = BitsoWebSocket::new().await.unwrap();
// You can subscribe to a specific orders channel
socket.subscribe(Subscription::Orders, Books::BtcMxn).await.unwrap();
                                                         
// You can also iterate over all the Books and Subscription channels
for book in Books::iter() {
    for subs in Subscription::iter() {
        socket.subscribe(subs, book).await.unwrap();
    }
}
loop {
    match socket.read().await.unwrap() {
        Response::Orders(r) => println!("{:?}", r),
        Response::Trades(r) => println!("{:?}", r),
        Response::DiffOrders(r) => println!("{:?}", r),
    }
}Implementations
pub async fn subscribe(
    &mut self, 
    subscription_type: Subscription, 
    book: Books
) -> Result<String>
pub async fn subscribe(
    &mut self, 
    subscription_type: Subscription, 
    book: Books
) -> Result<String>
Creates a subscription request to a given channel.
