pub struct BinanceSpotMessageHandler { /* private fields */ }Expand description
Message handler for Binance Spot WebSocket connections
Implementations§
Source§impl BinanceSpotMessageHandler
impl BinanceSpotMessageHandler
Sourcepub const fn new_trade_handler(
clock: Clock,
stats: Arc<RwLock<ConnectionStats>>,
trade_tx: Sender<TradeMessage>,
is_combined: bool,
subscription_message: Option<String>,
) -> Self
pub const fn new_trade_handler( clock: Clock, stats: Arc<RwLock<ConnectionStats>>, trade_tx: Sender<TradeMessage>, is_combined: bool, subscription_message: Option<String>, ) -> Self
Create a new message handler for trade messages
Sourcepub const fn new_orderbook_handler(
clock: Clock,
stats: Arc<RwLock<ConnectionStats>>,
orderbook_tx: Sender<OrderbookMessage>,
is_combined: bool,
subscription_message: Option<String>,
) -> Self
pub const fn new_orderbook_handler( clock: Clock, stats: Arc<RwLock<ConnectionStats>>, orderbook_tx: Sender<OrderbookMessage>, is_combined: bool, subscription_message: Option<String>, ) -> Self
Create a new message handler for orderbook messages
Trait Implementations§
Source§impl MessageHandler for BinanceSpotMessageHandler
impl MessageHandler for BinanceSpotMessageHandler
Source§fn on_connected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_connected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle connection established
Source§fn on_message<'life0, 'async_trait>(
&'life0 mut self,
message: Message,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_message<'life0, 'async_trait>(
&'life0 mut self,
message: Message,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a received message
Source§fn on_disconnected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_disconnected<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle connection closed
Source§fn on_error<'life0, 'async_trait>(
&'life0 mut self,
error: WebSocketError,
) -> Pin<Box<dyn Future<Output = Result<(), WebSocketError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn on_error<'life0, 'async_trait>(
&'life0 mut self,
error: WebSocketError,
) -> Pin<Box<dyn Future<Output = Result<(), WebSocketError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Handle errors
Source§fn set_sender(&mut self, _sender: UnboundedSender<Message>)
fn set_sender(&mut self, _sender: UnboundedSender<Message>)
Set the sender for outgoing messages (optional, default implementation does nothing)
Source§fn send_message(&self, _message: Message) -> Result<(), WebSocketError>
fn send_message(&self, _message: Message) -> Result<(), WebSocketError>
Send a message through the WebSocket (optional, default implementation returns error)
Auto Trait Implementations§
impl Freeze for BinanceSpotMessageHandler
impl !RefUnwindSafe for BinanceSpotMessageHandler
impl Send for BinanceSpotMessageHandler
impl Sync for BinanceSpotMessageHandler
impl Unpin for BinanceSpotMessageHandler
impl !UnwindSafe for BinanceSpotMessageHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more