Struct binance::userstream::UserStream [−][src]
pub struct UserStream {
pub client: Client,
pub recv_window: u64,
}
Fields
client: Client
recv_window: u64
Implementations
Get a listen key for the stream
Examples
use binance::{api::*, userstream::*, config::*};
let userstream: UserStream = Binance::new_with_env(&Config::testnet());
let start = tokio_test::block_on(userstream.start());
assert!(start.is_ok(), "{:?}", start);
assert!(start.unwrap().listen_key.len() > 0)
Keep the connection alive, as the listen key becomes invalid after 60mn
Examples
use binance::{api::*, userstream::*, config::*};
let userstream: UserStream = Binance::new_with_env(&Config::testnet());
let start = tokio_test::block_on(userstream.start());
assert!(start.is_ok(), "{:?}", start);
let keep_alive = tokio_test::block_on(userstream.keep_alive(&start.unwrap().listen_key));
assert!(keep_alive.is_ok())
Invalidate the listen key
Examples
use binance::{api::*, userstream::*, config::*};
let userstream: UserStream = Binance::new_with_env(&Config::testnet());
let start = tokio_test::block_on(userstream.start());
assert!(start.is_ok(), "{:?}", start);
let close = tokio_test::block_on(userstream.close(&start.unwrap().listen_key));
assert!(close.is_ok())
Trait Implementations
fn new_with_config(
api_key: Option<String>,
secret_key: Option<String>,
config: &Config
) -> UserStream
Create a binance API using environment variables for credentials
BINANCE_API_KEY=
Auto Trait Implementations
impl !RefUnwindSafe for UserStream
impl Send for UserStream
impl Sync for UserStream
impl Unpin for UserStream
impl !UnwindSafe for UserStream
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more