[][src]Trait crypto_ws_client::WSClient

pub trait WSClient {
    type Exchange;
    pub fn init(on_msg: fn(_: String), url: Option<&str>) -> Self::Exchange;
pub fn subscribe(&mut self, channels: &[String]);
pub fn unsubscribe(&mut self, channels: &[String]);
pub fn run(&mut self);
pub fn close(&mut self); }

The public interface of every WebSocket client.

Associated Types

type Exchange[src]

Exchange specific WebSocket client.

Loading content...

Required methods

pub fn init(on_msg: fn(_: String), url: Option<&str>) -> Self::Exchange[src]

Create a new client.

Arguments

  • on_msg - The message handler
  • url - Optional server url, usually you don't need specify it

pub fn subscribe(&mut self, channels: &[String])[src]

Subscribe channels.

pub fn unsubscribe(&mut self, channels: &[String])[src]

Unsubscribe channels.

pub fn run(&mut self)[src]

Start the infinite loop until the server closes the connection.

pub fn close(&mut self)[src]

Close the client.

Loading content...

Implementors

impl WSClient for BinanceDeliveryWSClient[src]

type Exchange = BinanceDeliveryWSClient

impl WSClient for BinanceFuturesWSClient[src]

type Exchange = BinanceFuturesWSClient

impl WSClient for BinanceSpotWSClient[src]

type Exchange = BinanceSpotWSClient

impl WSClient for HuobiCoinSwapWSClient[src]

type Exchange = HuobiCoinSwapWSClient

impl WSClient for HuobiFuturesWSClient[src]

type Exchange = HuobiFuturesWSClient

impl WSClient for HuobiOptionWSClient[src]

type Exchange = HuobiOptionWSClient

impl WSClient for HuobiSpotWSClient[src]

type Exchange = HuobiSpotWSClient

impl WSClient for HuobiUsdtSwapWSClient[src]

type Exchange = HuobiUsdtSwapWSClient

impl WSClient for OKExWSClient[src]

type Exchange = OKExWSClient

Loading content...